Lumiera 0.pre.04~rc.1
»edit your freedom«
Loading...
Searching...
No Matches
transiently.hpp File Reference

Test helper to perform temporary manipulations within a test scope. More...

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>

Namespaces

namespace  lib
 Implementation namespace for support and library code.
 
namespace  lib::test
 Unit tests for the Lumiera support library.
 

Macros

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

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...
 

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
 

Macro Definition Documentation

◆ TRANSIENTLY

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

Macro to simplify capturing assignments.

Remarks
use as TRANSIENTLY(blah) = moo;

Definition at line 121 of file transiently.hpp.