![]() |
Arene Base
Fundamental Utilities For Safety Critical C++
|
Go to the source code of this file.
| #define ARENE_CPP14_INLINE_VARIABLE | ( | type, | |
| name ) |
Emulates C++17's inline variable declarations for function objects.
| type | The type of the function object to instantiate |
| name | The name the instantiated object should have in the containing namespace. |
This macro is used to correctly declare the instantiation of function objects in a way compatible with both C++14 and >= C++17 contexts, inspired by Eric Niebler's original paper here: https://ericniebler.com/2014/10/21/customization-point-design-in-c11-and-beyond/
In a <= C++17 context, the type is simply declared as inline constexpr type name{} . In C++14 contexts, where inline variable declarations are not permitted, the same effect is achieved by indirecting through the arene::base::detail::cpp14_inline_static_const helper template. The usage looks like so: