Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
Facilities For Creating Inline Variables in C++14

C++17 added support for declaring inline variables, which allow variables to be defined in header files without violating the One Definition Rule (ODR). To allow similar functionality in C++14, arene-base provides a facility, ARENE_CPP14_INLINE_VARIABLE(type,name), for creating "inline variables" in C++14. This primarily intended to ease the creation of Niebloid-like function objects. The public header is:

An example of defining a function object using the macro can be seen below:

Note
The type used with the macro must be constexpr default constructible.