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 a snapshot of the develop branch, built from commit 8839b0fcdb.
PrevUpHomeNext

Function template names_as_array

boost::pfr::names_as_array — Creates a std::array from names of fields of an simple aggregate T.

Synopsis

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


template<typename T> 
  constexpr std::array< std::string_view, boost::pfr::tuple_size_v< T > > 
  names_as_array();

Description

Example:

struct my_struct { int i, short s; };
std::array<std::string_view, 2> a = boost::pfr::names_as_array<my_struct>();
assert(a[0] == "i");


PrevUpHomeNext