SpECTRE Documentation Coverage Report
Current view: top level - Utilities - CleanupRoutine.hpp Coverage Total Hit
Commit: 0d1d717af84a81fb1284a20c4013708fe85cc2f0 Lines: 11.1 % 9 1
Test Date: 2026-10-22 17:29:42
Legend: Lines:     hit not hit

            Line data    Source code
       1            0 : // Distributed under the MIT License.
       2              : // See LICENSE.txt for details.
       3              : 
       4              : #pragma once
       5              : 
       6              : #include <utility>
       7              : 
       8              : /// An object that calls a functor when it goes out of scope.
       9              : ///
      10              : /// \snippet Test_CleanupRoutine.cpp cleanup_routine
      11              : template <typename F>
      12            1 : class CleanupRoutine {
      13              :  public:
      14            0 :   CleanupRoutine(F routine) : routine_(std::move(routine)) {}
      15              : 
      16              :   // Copying/moving don't make sense, and it's not clear what a
      17              :   // moved-out-of instance would be expected to do.
      18            0 :   CleanupRoutine(const CleanupRoutine&) = delete;
      19            0 :   CleanupRoutine(CleanupRoutine&&) = delete;
      20            0 :   CleanupRoutine& operator=(const CleanupRoutine&) = delete;
      21            0 :   CleanupRoutine& operator=(CleanupRoutine&&) = delete;
      22              : 
      23            0 :   ~CleanupRoutine() { routine_(); }
      24              : 
      25              :  private:
      26            0 :   F routine_;
      27              : };
        

Generated by: LCOV version 2.0-1