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

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

Function template get_name

boost::pfr::get_name — Returns name of a field with index I in simple aggregate T.

Synopsis

// In header: <boost/pfr/core_name.hpp>


template<std::size_t I, typename T> 
  BOOST_PFR_BEGIN_MODULE_EXPORT constexpr std::string_view get_name();

Description

Example:

struct my_struct { int i, short s; };

assert(boost::pfr::get_name<0, my_struct>() == "i");
assert(boost::pfr::get_name<1, my_struct>() == "s");


PrevUpHomeNext