Comments (6)
Thank you! Some Russian guy is going to be grateful for this, even if he is not aware of the behind-the-scenes conversation.
from utility.
Looking at the documentation at http://www.boost.org/doc/libs/1_65_1/libs/utility/operators.htm#deref, it is documented to return &*i
, which must be convertible to P
. Given that the library is quite old and it has been like that for >=15 years, I wonder if there really is a problem that needs to be fixed. Plus we would add a dependency. What are your thoughts on this? Or do you have a specific problem that needs fixing?
from utility.
Hi Daniel,
It's a real problem reported by a user of Boost.MultiIndex βwhich library is BTW 13 years old :-)
Basically, Boost.MultiIndex does not work with elements whose operator&
is overloaded. The problem is scattered through the code, one of the locations being its dependency on boost/operators.hpp
.
I understand changing this on your side requires that you update the documentation from
Requirements: (&*i
). Return convertible to P
.
to
Requirements: *i
. Return convertible to R
.
which is not, strictly speaking, a relaxation of the former condition β*i
could in principle be anything as long as &*i
returns a pointer. So it is up to you; if you decide to not do the change I can fix the issue on my side, although it's more verbose in terms of LOCs touched and the root problem might hit other code using boost/operators.hpp
. FWIW commercial implementations of std containers guard themselves against abuses of operator&
overloading via constructs similar to boost::addressof
.
Thank you
from utility.
If Boost.MultiIndex is only 13 years old, you loose ;-P
Joking aside, I am not trying to ignore the problem, I was just curious where this was coming from. I think it is likely enough that people are not relying on the current implementation to allow them to "abuse" an overloaded operator&
, so fixing it by using boost::addressof
seems reasonable.
For the documentation part, well, it's not correct that the "return" is directly convertible to R
. Maybe this would work:
Requirements: *i
. Pointer to the return convertible to R
.
or "...returned value..." instead of "...return..."?
from utility.
Requirements:
*i
. Pointer to the return convertible toR
.
I think this not correct either... What about
Requirements: *i
. The address of the returned value convertible to P
.
"Address of a value" is a well-defined concept that does not depend on operator&
, so I think this holds water.
from utility.
OK, agreed. I'll commit a fix soon.
from utility.
Related Issues (20)
- boost::phoenix::bind issue in c++17. HOT 4
- [MSVC][std:c++latest] Boost\libs\utility run tests failed due to error C2666: 'comparible_UDT::operator ==': overloaded functions have similar conversions HOT 1
- Use core/lightwieght-test.
- small library for std::ios HOT 1
- broken link to String Ref in docs HOT 1
- Missing operator in less_than_comparable2? HOT 1
- string_view isn't included in the docs
- boost::equality_comparable2 operator== can compile into infinite loop with clang10 and -std=c++2a HOT 37
- compare_pointees.hpp should permit a predicate HOT 2
- string_ref::remove_prefix() doesn't conform with reference HOT 6
- operators_test invokes undefined behavior in random input tests HOT 2
- boost::utility::string_view should name a type HOT 8
- result_of cannot handle member function pointer to __cdecl function
- boost::string_view::max_size() erroneously returns size()
- remove_prefix and remove_suffix overly permissive HOT 7
- add contains member function to boost::string_view
- Critical: erronous noexcept specifications on boost::string_view::compare
- add c++20/23 constructors to basic_string_view HOT 3
- string_view::substr() doesn't default pos=0
- error C2676: Binary '+': 'T' does not define this operator or a conversion to an acceptable type for the predefined operator HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from utility.