|
cxxomfort
rel.20211024
Simple backports for C++ - https://ryan.gulix.cl/fossil.cgi/cxxomfort/
|
Describes cxxomfort macros for code generation. More...
Macros | |
| #define | CXXO_DEFAULT_DEFAULT_CONSTRUCTOR(Type) Type () = default [or equivalent] |
Declares a “ =default ” default constructor. More... | |
| #define | CXXO_DEFAULT_COPY_CONSTRUCTOR(Type, Su, ...) |
Declares a =default copy constructor. More... | |
| #define | CXXO_TYPEOF(expr) __typeof__(expr) [or equivalent] |
Obtains the type of expr if there is a __typeof__-like facility to do so. More... | |
| #define | CXXO_STRINGIZE(...) CXXO_STRINGIZE_IMPL(__VA_ARGS__) |
| #define | CXXO_STRINGIZE1(x) CXXO_STRINGIZE1_IMPL1(x) |
| #define | CXXO_JOIN(x, y) CXXO_JOIN_IMPL1(x,y) |
Describes cxxomfort macros for code generation.
Cxxomfort includes a number of macros that help generate code. This includes in particular code constructs that can change across C++ Standard versions, such as noexcept conditionals, constructors definition, and sequence construction.
For generating code for types and classes:
CXXO_DEFAULT_DEFAULT_CONSTRUCTOR() - declares a class's default constructor as =default (or a close equivalent in pre-C++11). CXXO_DELETED_DEFAULT_CONSTRUCTOR() - declares a class's default constructor as =delete (or a close equivalent in pre-C++11). CXXO_DEFAULT_COPY_CONSTRUCTOR() - declares a class's default copy constructor as =default (or implements an alternative pre-C++11). CXXO_DELETED_COPY_CONSTRUCTOR() - declares a class's default copy constructor as =delete-d (or a close equivalent pre-C++11).For generating functions:
Including #include <cxxomfort/base.hpp> (explicitly or implicitly) gives access to the following macros:
CXXO_COPYABLE_AND_MOVABLE(classname) - declare a class as copyable and movable, native in C++11 or using move-emulation in C++03.Including #include <cxxomfort/impl/relationals.hpp> gives access to the following feature:
CXXO_GENERATE_RELATIONALS(classname): automatically generate non-member relational operators > , >=, <=, != for a class that already implements operators == , <.For evaluating expressions:
CXXO_TYPEOF() - determines the type of an expression if the compiler has the capability.CXXO_DECLTYPE() - determines the type of an expression in C++11-onwards mode.Including #include <cxxomfort/library/i12n.hpp> (explicitly or implicitly) gives access to the sequence intialization helper macros :
CXXO_I12N_BEG CXXO_I12N_END CXXO_I12N_SEQ | #define CXXO_DEFAULT_DEFAULT_CONSTRUCTOR | ( | Type | ) | Type () = default [or equivalent] |
Declares a “ =default ” default constructor.
Using this macro in the body of a class will invoke, where available, the =default default constructor. In pre-C++11, it will invoke a throw() empty constructor.
| #define CXXO_DEFAULT_COPY_CONSTRUCTOR | ( | Type, | |
| Su, | |||
| ... | |||
| ) |
Declares a =default copy constructor.
| Su | constructor suffix (eg.: noexcept) |
| ... | Explicit constructor body (for C++03) |
Using this macro in the body of a class invokes, starting with C++11, a =default copy constructor. In C++03, it generates the code for a copy constructor using the subsequent arguments to the macro as code for the member initializer list, using the variable name From for the argument of the copy constructor.
| #define CXXO_TYPEOF | ( | expr | ) | __typeof__(expr) [or equivalent] |
Obtains the type of expr if there is a __typeof__-like facility to do so.
| expr | An expression evaluating to a type. Since this is a macro, it can't take commas. |
In C++11 onwards, this evaluates to decltype(expr) ; in other modes, it will ealuate to __typeof__(expr) if the feature is available or will error out if not.
Referenced by cxxomfort::cxxostd::bind_front().
| #define CXXO_STRINGIZE | ( | ... | ) | CXXO_STRINGIZE_IMPL(__VA_ARGS__) |
Stringizes passed (transforms them into a string literal)
| #define CXXO_STRINGIZE1 | ( | x | ) | CXXO_STRINGIZE1_IMPL1(x) |
Stringizes a single token (transforms it into a string literal)
| #define CXXO_JOIN | ( | x, | |
| y | |||
| ) | CXXO_JOIN_IMPL1(x,y) |
Joins two tokens
1.8.13