|
cxxomfort
rel.20211024
Simple backports for C++ - https://ryan.gulix.cl/fossil.cgi/cxxomfort/
|
Files | |
| file | alignof.hpp |
| Implementation details for "alignof" emulation. | |
| file | base/cstdint.hpp |
| file | explicit_cast.hpp |
Explicit cast, and explicit_cast conversion operator for C++03Interfaces defined in this header: | |
| file | nullptr.hpp |
| Implementation detaisl for "nullptr" backport. | |
| file | static_assert.hpp |
| Implementation details for "static_assert" backport. | |
| file | base.hpp |
| Minimal cxxomfort setup.For more complete cxxomfort setup (includes more headers, adds new names and functions), use one of these: | |
The set of basic features of cxxomfort. These features are included automatically when #include <cxxomfort/base.hpp> or any of the cxxomfort headers are #include -d-.
Most of the features here involve setting up a common ground between C++03 and C++11; of particular interest is the backporting of the two keywords nullptr and static_assert .
alignof() #nullptr - see nullptr - null pointer literal .explicit_cast<> .cxxomfort includes among its facilities the "official" backport implementation for the special literal nullptr which represents a "null pointer constant".
nullptr can be used anywhere where a pointer could be initialized to a "null" value, replacing the usage of eg.: int * p = NULL or 0 in older code.
The Standard also provides the name std::nullptr_t for the type of the of the null pointer literal and can be used for overloading. Cxxomfort also provides this name dirctly.
The macro CXXOMFORT_IMPLEMENTS_nullptr informs of the status of implementation:
>= ...NATIVE() - found as a reserved word (C++11 onwards) >= ...BACKPORT() - not found, implemented by cxxomfort as a reserved object. >= ...EMULATION() - not found, implemented by cxxomfort as a macro with the value 0.else - not implemented by cxxomfort.cxxomfort includes among its facilities a backport implementation for the "compile time assertions" feature: the C++11 keyword static_assert can be used to issue a check that is performed a compile time, resulting in an error message if the condition is not met.
Example usage:
As a cxxomfort-specific extension, the macro static_assert0 is also provided that emulates C*+17's "short static_assert" feature:
The macro CXXOMFORT_IMPLEMENTS_static_assert informs of the status of static_assert as found by the library:
>= CXXO_IMPLSTATUS_NATIVE() - found as a keyword. >= CXXO_IMPLSTATUS_EMULATION() - implemented by cxxomfort as a macro. >0 - found as a macro not defined by cxxomfort (possibly vendored) == 0 - not found, and not implemented.See static_assert for more details.
cxxomfort library automatically includes an implementation of Imperfect C++'s explicit_cast<> for use in types that need to enable explicit conversion in both C++11 (where explicit operator... is available) and C++03.
See explicit_cast for more information and this StackOverflow question for more rationale on implementation and mapping to C++11.
cxxomfort implements a simplified variant of Boost:Move aka "move semantics" in C++03.
cxxomfort provides backports for the global iterator accessors std::begin and std::end in C++11 which allow for uniform access of sequences and container objects.
For related features see: size() , move() , fixed_vector .
The global begin, end are documented at begin and end @ cppreference .
Except for this page all features should be explicitly included to the project by #include -ing the necessary header.
1.8.13