mirror of
https://github.com/boostorg/pfr.git
synced 2026-01-19 04:22:13 +00:00
25 lines
526 B
C++
25 lines
526 B
C++
// Copyright (c) 2016-2020 Antony Polukhin
|
|
//
|
|
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
|
|
|
|
//[pfr_motivating_example
|
|
#include <iostream>
|
|
#include <string>
|
|
|
|
#include "boost/pfr.hpp"
|
|
|
|
struct some_person {
|
|
std::string name;
|
|
unsigned birth_year;
|
|
};
|
|
|
|
int main() {
|
|
some_person val{"Edgar Allan Poe", 1809};
|
|
|
|
std::cout << boost::pfr::get<0>(val)
|
|
<< " was born in " << boost::pfr::get<1>(val);
|
|
}
|
|
//]
|