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.
This fixes an issue where we cannot call
myValue.set(1.5)
ordouble d=1.5; myValue.set(d);
because both versions fail to link. They both match the forwarding reference set(T&&) function better than the expectedset(T const&)
version, and it is not defined for several types. Problems occur withdouble
,bool
,int64
, andstd::string.
The problem with std::string is only with lvalues, in that the "non-const to const" conversion makes theset(std::string const&)
a worse match than the rvalue forwardig reference, which was not defined.I changed the forwarding reference from a template to three explicit function declarations, so we don't have such a large set of interfaces inadvertently caught by the template.
I also ran clang-format in another commit, prior to making the change, since the code did not match its own .clang-format file format.
The changes in the tests will show the link failures mentioned in the commit message, if run with the original picojson header, but it passes after my changes.
The issue with std::string& is that an lvalue