Implementation of C++17's new "vocabulary types" - std::optional , std::variant and std::any built around cxxomfort.

As with the rest of cxxomfort, these utilities live in namespace cxxomfort::cxxostd and are mirrored to namespace std.

Besides these backports, cxxomfort also adds a few assist utilities not available in the standard:

namespace cxxomfort {

T const&    ifnull (optional<T> opt, T const& alt)  ;
//< analogue to SQL's ifnull, 
// returns either the value of 'opt' if it has one, or the alternative 'alt' otherwise.



Clone/download and add the vocabulary directory to the compiler's search paths.

Include as:

#include <cxxomfort/base.hpp> // this will head to cxxomfort's includes
#include <cxxomfort/optional.hpp>
#include <cxxomfort/variant.hpp>
#include <cxxomfort/any.hpp>

Or like this, if you are using cxxomfort's transparent headers:

#include <cxxomfort/base.hpp> // this will head to cxxomfort's includes
#include <optional>
#include <variant>
#include <any>

If the compiler is running in C++17 mode or above, this library just forwards to the Standard headers and does nothing on its own except providing a few assist utilities.


For documentation on how to use those library types and associated utilities, check documentation such as cppreference:

For a list of differences or behavious specific to this cxxomfort implementation check cxxostd/optional, cxxostd/variant or cxxomfort/any.