-
Notifications
You must be signed in to change notification settings - Fork 165
X3: Improve situation with move only types #472
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
Kojoley
merged 5 commits into
boostorg:develop
from
Kojoley:x3-improve-situation-with-move-only-types
Feb 27, 2019
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
f371ccf
X3: push_back has to forward actual reference type
Kojoley 8bd9b6e
X3: Fixed container of move only types with sequence
Kojoley 793d896
X3: Move only types with optional
Kojoley 660d8ac
X3.Tests: Fix odd temporary attribute creation
Kojoley 5d80257
X3.Tests: MSVC14.0 have problems with variable templates
Kojoley 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
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
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,47 @@ | ||
| /*============================================================================= | ||
| Copyright (c) 2019 Nikita Kniazev | ||
|
|
||
| Use, modification and distribution is subject to 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) | ||
| =============================================================================*/ | ||
| #if !defined(BOOST_SPIRIT_TEST_X3_UTILS_HPP) | ||
| #define BOOST_SPIRIT_TEST_X3_UTILS_HPP | ||
|
|
||
| #include <boost/spirit/home/x3/core/parser.hpp> | ||
|
|
||
| struct move_only | ||
| { | ||
| move_only(move_only&&) = default; | ||
| move_only& operator=(move_only&&) = default; | ||
| }; | ||
|
|
||
|
|
||
| template <typename T> | ||
| struct synth_parser : boost::spirit::x3::parser<synth_parser<T>> | ||
| { | ||
| typedef T attribute_type; | ||
|
|
||
| static bool const has_attribute = true; | ||
| static bool const handles_container = false; | ||
|
|
||
| template <typename Iterator, typename Context, | ||
| typename RuleContext, typename Attribute> | ||
| bool parse(Iterator& iter, Iterator const& last, Context const&, | ||
| RuleContext&, Attribute& attr) const | ||
| { | ||
| if (iter != last && *iter == 's') { | ||
| ++iter; | ||
| boost::spirit::x3::traits::move_to(attribute_type{}, attr); | ||
| return true; | ||
| } | ||
| return false; | ||
| } | ||
| }; | ||
|
|
||
| template <typename T> | ||
| synth_parser<T> synth{}; | ||
|
|
||
| synth_parser<move_only> const synth_move_only{}; | ||
|
|
||
| #endif |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the reason behind such changes? Reducing use of standard library (compile time)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed surprising move of lvalue. And yes,
std::forwardis not zero cost in terms of compile time (also a surprising thing).