-
Notifications
You must be signed in to change notification settings - Fork 167
Field's names functionality #129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
4a1defa
Add methods to extract fields names
denzor200 e8e077c
fix for cxx14 build
denzor200 f09357c
fix lint issues
denzor200 454947d
review
denzor200 03e1d76
Merge remote-tracking branch 'origin/develop' into feature/get_name
denzor200 fe5a70b
Merge remote-tracking branch 'origin/develop' into feature/get_name
denzor200 196aeb6
Fix lint issue about nonascii symbol
denzor200 50c9d6f
Fix strip_boost_namespace.sh
denzor200 b15196c
Fix MSVC
denzor200 6f544ce
Add Clang support
denzor200 6e23ed5
Fix nonascii fields
denzor200 a5b9cd5
Add test for big structures
denzor200 9b6a0de
Refactoring for parser
denzor200 efd25e9
review
denzor200 9b2817a
Parsing ala boost type_index
denzor200 fcfca74
Write docs
denzor200 dbbfa6e
Parser might be explicitly tagged as backward
denzor200 2c79ac7
Fix CI
denzor200 0cb5cf2
Fix strip_boost_namespace.sh
denzor200 5a7d652
Fix docs
denzor200 dd8a527
Rename C++20 features detectors
denzor200 8794056
review
denzor200 6dcf66c
Fix for old MSVC compiler
denzor200 3f07e71
relax standard library requirements
apolukhin 41e87fb
Do not require Python to run tests
apolukhin 27b9706
Fix compilation on MSVC
apolukhin 9cc76bc
Suppress non-ASCII warning from boost-inspect
apolukhin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| // Copyright (c) 2023 Bela Schaum, X-Ryl669, Denis Mikhailov. | ||
| // | ||
| // 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) | ||
|
|
||
|
|
||
| // Initial implementation by Bela Schaum, https://github.com/schaumb | ||
| // The way to make it union and UB free by X-Ryl669, https://github.com/X-Ryl669 | ||
| // | ||
|
|
||
| #include <boost/pfr/config.hpp> | ||
|
|
||
| #if BOOST_PFR_CORE_NAME_ENABLED && BOOST_PFR_USE_CPP17 | ||
| //[pfr_example_get_name | ||
| /*` | ||
| Since C++20 it's possible to read name of structure fields by index using Boost.PFR library. | ||
| The following example shows how to do it using [funcref boost::pfr::get_name]. | ||
|
|
||
| Let's define some structure: | ||
| */ | ||
| #include <boost/pfr/core_name.hpp> | ||
|
|
||
| struct foo { // defining structure | ||
| int some_integer; | ||
| char c; | ||
| }; | ||
|
|
||
| /*` | ||
| We can access field's names of that structure by index: | ||
| */ | ||
| constexpr auto r1 = boost::pfr::get_name<0, foo>(); // reading name of field with index 0, returns string `some_integer` | ||
| constexpr auto r2 = boost::pfr::get_name<1, foo>(); // reading name of field with index 1, returns string `c` | ||
| //] [/pfr_example_get_name] | ||
| #endif | ||
|
|
||
| int main() { | ||
| #if BOOST_PFR_CORE_NAME_ENABLED && BOOST_PFR_USE_CPP17 | ||
| if (r1 != "some_integer") return 1; | ||
| if (r2 != "c") return 2; | ||
| #endif | ||
|
|
||
| return 0; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.