You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -551,6 +551,8 @@ parameters provided to `BOOST_PFR_CORE_NAME_PARSING` macro [*and] the initial ou
551
551
552
552
[section How it works]
553
553
554
+
[h2 Fields count detection and getting references to members]
555
+
554
556
Short description:
555
557
556
558
# at compile-time: use aggregate initialization to detect fields count in user-provided structure
@@ -577,6 +579,17 @@ Long description of some basics: [@https://youtu.be/UlNUNxLtBI0 Antony Polukhin:
577
579
Long description of some basics of C++14 with [link boost_pfr.limitations_and_configuration [*BOOST_PFR_USE_LOOPHOLE == 0]]: [@https://youtu.be/abdeAew3gmQ Antony Polukhin: C++14 Reflections Without Macros, Markup nor External Tooling].
578
580
Description of the [*BOOST_PFR_USE_LOOPHOLE == 1] technique by its inventor Alexandr Poltavsky [@http://alexpolt.github.io/type-loophole.html in his blog].
579
581
582
+
[h2 Field name retrieval]
583
+
584
+
# at compile-time:
585
+
* Get references to members of an object of type `T` in `constexpr` function
586
+
* Feed the reference from previous as a template parameter to a `constexpr` function with `template <auto member_ptr>`.
587
+
That function returns `__PRETTY_FUNCTION__` or some other vendor specific macro that prints the whole name of a function
588
+
along with the template arguments.
589
+
* The returned value from previous step contains the member name ([@https://godbolt.org/z/K4aWdcE9G godbolt example]). Do some
590
+
compiler specific parsing of the value and make a `std::string_view` that contains only the member name.
591
+
# at run-time: return the `std::string_view` with the member name.
0 commit comments