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
better subview #709
better subview #709
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #709 +/- ##
========================================
Coverage 99.08% 99.08%
========================================
Files 69 69
Lines 6547 6553 +6
========================================
+ Hits 6487 6493 +6
Misses 60 60
Continue to review full report at Codecov.
|
|
Comparison operators need to change as well. |
Also, although it might fix the Boost.JSON building issue, users' code that invokes conversion to |
Maybe we should apply a gcc 8.3 specific fix? |
I updated the comparisons |
include/boost/json/string.hpp
Outdated
@@ -2782,7 +2792,7 @@ typename std::enable_if< | |||
operator==(T const& lhs, U const& rhs) noexcept | |||
#endif | |||
{ | |||
return string_view(lhs) == string_view(rhs); | |||
return lhs.subview() == rhs.subview(); |
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.
This may not work if either T
or U
is neither string
or string_view
. You're testing for is_convertible
, which allows any type that may not have subview()
member.
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.
hmm this requires a bit more thought, thanks
I'm not opposed to a gcc-specific workaround. I've just not figured out a way to make the conversions to compile. |
How about this? 1949b0a |
It seems to compile on gcc 8.3 but I am not sure whether I need to actually instantiate those operators or not |
Seems to be working for my local build of Boost.JSON. Also on godbolt. Thanks! PS: |
|
|
|
|
fix #708