mirror of
https://github.com/boostorg/pfr.git
synced 2026-01-19 04:22:13 +00:00
Fix docs rendering on narrow screens
This commit is contained in:
@@ -42,7 +42,9 @@ void test_examples() {
|
||||
|
||||
//[pfr_quick_examples_flat_functors_uset
|
||||
// no `std::hash<bar>` or `bar::operator==(const bar&)` defined
|
||||
std::unordered_set<bar, boost::pfr::flat_hash<bar>, boost::pfr::flat_equal_to<>> my_uset;
|
||||
std::unordered_set<
|
||||
bar, boost::pfr::flat_hash<bar>,
|
||||
boost::pfr::flat_equal_to<>> my_uset;
|
||||
my_uset.insert(var);
|
||||
//]
|
||||
}
|
||||
@@ -92,7 +94,7 @@ void test_examples() {
|
||||
bar var{'A', {777, 3.141593}};
|
||||
|
||||
//[pfr_quick_examples_for_each
|
||||
// incrementing first field on 1 and calling foo::operator+= for second field:
|
||||
// increments first field on 1, calls foo::operator+= for second field
|
||||
boost::pfr::for_each_field(var, [](auto& field) {
|
||||
field += 1;
|
||||
});
|
||||
@@ -108,8 +110,9 @@ void test_examples() {
|
||||
bar var{'A', {777, 3.141593}};
|
||||
|
||||
//[pfr_quick_examples_flat_for_each_idx
|
||||
boost::pfr::flat_for_each_field(var, [](const auto& field, std::size_t idx) {
|
||||
std::cout << idx << ": " << boost::typeindex::type_id_runtime(field) << '\n';
|
||||
boost::pfr::flat_for_each_field(var, [](auto& field, std::size_t idx) {
|
||||
std::cout << idx << ": "
|
||||
<< boost::typeindex::type_id_runtime(field) << '\n';
|
||||
});
|
||||
//]
|
||||
}
|
||||
@@ -118,8 +121,9 @@ void test_examples() {
|
||||
bar var{'A', {777, 3.141593}};
|
||||
|
||||
//[pfr_quick_examples_for_each_idx
|
||||
boost::pfr::for_each_field(var, [](const auto& field, std::size_t idx) {
|
||||
std::cout << idx << ": " << boost::typeindex::type_id_runtime(field) << '\n';
|
||||
boost::pfr::for_each_field(var, [](auto& field, std::size_t idx) {
|
||||
std::cout << idx << ": "
|
||||
<< boost::typeindex::type_id_runtime(field) << '\n';
|
||||
});
|
||||
//]
|
||||
}
|
||||
@@ -127,13 +131,15 @@ void test_examples() {
|
||||
|
||||
{
|
||||
//[pfr_quick_examples_tuple_size
|
||||
std::cout << "tuple_size: " << boost::pfr::tuple_size<bar>::value << '\n';
|
||||
std::cout << "tuple_size: "
|
||||
<< boost::pfr::tuple_size<bar>::value << '\n';
|
||||
//]
|
||||
}
|
||||
|
||||
{
|
||||
//[pfr_quick_examples_flat_tuple_size
|
||||
std::cout << "flat_tuple_size: " << boost::pfr::flat_tuple_size<bar>::value << '\n';
|
||||
std::cout << "flat_tuple_size: "
|
||||
<< boost::pfr::flat_tuple_size<bar>::value << '\n';
|
||||
//]
|
||||
}
|
||||
|
||||
@@ -176,7 +182,8 @@ void test_examples() {
|
||||
{
|
||||
bar var{'A', {777, 3.141593}};
|
||||
//[pfr_quick_examples_structure_to_tuple
|
||||
std::tuple<char, foo> t = boost::pfr::structure_to_tuple(var); // C++17 is required
|
||||
// C++17 is required
|
||||
std::tuple<char, foo> t = boost::pfr::structure_to_tuple(var);
|
||||
std::get<1>(t) = foo{1, 2};
|
||||
//]
|
||||
std::cout << "boost::pfr::structure_to_tuple(var) :\n" << var << '\n';
|
||||
@@ -196,7 +203,8 @@ void test_examples() {
|
||||
{
|
||||
bar var{'A', {777, 3.141593}};
|
||||
//[pfr_quick_examples_structure_tie
|
||||
std::tuple<char&, foo&> t = boost::pfr::structure_tie(var); // C++17 is required
|
||||
// C++17 is required
|
||||
std::tuple<char&, foo&> t = boost::pfr::structure_tie(var);
|
||||
std::get<1>(t) = foo{1, 2};
|
||||
//]
|
||||
std::cout << "boost::pfr::structure_tie(var) :\n" << var << '\n';
|
||||
|
||||
Reference in New Issue
Block a user