Boost C++ Libraries of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
Prev Up HomeNext

Constrained template macros

Overridable: All of the following macros are overridable, define before inclusion.

Header: <boost/outcome/config.hpp>

These macros expand into either the syntax for directly specifying constrained templates in C++ 20, or into a SFINAE based emulation for earlier C++ versions. Form of usage looks as follows:

    // If this is a valid expression
    // If this predicate is true
    BOOST_OUTCOME_TPRED(predicate::template enable_error_condition_converting_constructor<ErrorCondEnum>)
    // Any additional requirements follow here ...
  constexpr basic_result(ErrorCondEnum &&t, error_condition_converting_constructor_tag /*unused*/ = {});

Be aware that slightly different semantics occur for real C++ 20 constrained templates than for the SFINAE emulation.

Last revised: December 12, 2018 at 22:01:42 UTC

Prev Up HomeNext