Lumiera  0.pre.03
»edit your freedom«
transiently.hpp File Reference

Go to the source code of this file.

Description

Test helper to perform temporary manipulations within a test scope.

Such safe manipulations can be achieved by tying the clean-up to the destructor of a token object in local scope. In the simple form, a reference to the original and the original value are captured; alternatively, both manipulation and clean-up can be given as Lambdas.

See also
TestHelper_test::checkLocalManipulation
scheduler-service-test.cpp

Definition in file transiently.hpp.

#include "lib/nocopy.hpp"
#include "lib/meta/function.hpp"
#include "lib/ppmpl.h"
#include <utility>

Classes

class  Transiently< TAR >
 Token to capture a value and restore original when leaving scope. More...
 
class  Transiently< void(void)>
 Variation where manipulation is done by λ More...
 

Macros

#define TRANSIENTLY(_OO_)   lib::test::Transiently PPMPL_CAT(transientlyManipulated_,__LINE__)(_OO_); PPMPL_CAT(transientlyManipulated_,__LINE__)
 Macro to simplify capturing assignments. More...
 

Functions

template<typename FUN , typename = lib::meta::enable_if<lib::meta::has_Sig<FUN, void(void)>>>
 Transiently (FUN &&) -> Transiently< void(void)>
 deduction guide: use λ for manipulation and clean-up More...
 

Namespaces

 lib
 Implementation namespace for support and library code.
 

Macro Definition Documentation

◆ TRANSIENTLY

#define TRANSIENTLY (   _OO_)    lib::test::Transiently PPMPL_CAT(transientlyManipulated_,__LINE__)(_OO_); PPMPL_CAT(transientlyManipulated_,__LINE__)

Function Documentation

◆ Transiently()

lib::test::Transiently ( FUN &&  ) -> Transiently< void(void)>

deduction guide: use λ for manipulation and clean-up

Remarks
activated when given a function with signature <void(void)>