Boost C++ Libraries

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

PrevUpHomeNext

Limitations and Configuration

[Caution] Caution

Recommended C++ Standards are C++17 and above. Library requires at least C++14! Pre C++14 compilers (C++11, C++03...) are not supported.

Boost.PFR library works with types that satisfy the requirements of SimpleAggregate: aggregate types without base classes, const fields, references, or C arrays:

struct simple_aggregate {  // SimpleAggregate
    std::string name;
    int age;
    boost::uuids::uuid uuid;
};

struct empty {             // SimpleAggregate
};

struct aggregate : empty { // not a SimpleAggregate
    std::string name;
    int age;
    boost::uuids::uuid uuid;
};

The library may work with aggregates that don't satisfy the requirements of SimpleAggregate, but the behavior tends to be non-portable.

Configuration Macro

By default Boost.PFR auto-detects your compiler abilities and automatically defines the configuration macro into appropriate values. If you wish to override that behavior, just define:

Table 28.2. Macros

Macro name

Effect

BOOST_PFR_USE_CPP17

Define to 1 if you wish to override Boost.PFR choice and use C++17 structured bindings for reflection. Define to 0 to override Boost.PFR choice and disable C++17 structured bindings usage.

BOOST_PFR_USE_LOOPHOLE

Define to 1 if you wish to override Boost.PFR choice and exploit CWG 2118 for reflection. Define to 0 to override Boost.PFR choice and disable CWG 2118 usage.

BOOST_PFR_USE_STD_MAKE_INTEGRAL_SEQUENCE

Define to 0 if you are hit by the template instantiation depth issues with std::make_integer_sequence and wish to use Boost.PFR version of that metafunction. Define to 1 to override Boost.PFR detection logic.


Details on Limitations

The Boost.PFRs reflection has some limitations that depend on a C++ Standard and compiler capabilities:


PrevUpHomeNext