Opened 11 years ago
Last modified 5 years ago
#5811 reopened Bugs
indirected range adaptor not satisfied with unary dereference operator
Reported by: | Owned by: | Neil Groves | |
---|---|---|---|
Milestone: | To Be Determined | Component: | range |
Version: | Boost Development Trunk | Severity: | Problem |
Keywords: | optional element_type range adaptor indirected | Cc: |
Description
The documentation for Range's indirected adaptor claims that it is usable with anything that has an unary operator*().
When using it with a range of optional<int>, it seems to require an element_type inner type, which optional doesn't expose and the docs does not require.
The following testcase fails to compile with VC10 and GCC 4.2.3:
#include <boost/optional.hpp> #include <boost/range/adaptors.hpp> #include <vector> int main(int argc, char* argv[]) { std::vector<boost::optional<int> > v; v | boost::adaptors::indirected; }
Change History (4)
comment:1 by , 11 years ago
comment:2 by , 11 years ago
I found this related topic on stackoverflow:
http://stackoverflow.com/questions/6123327/use-boostoptional-together-with-boostadaptorsindirected
The first answer solved the problem for me, i don't know if it's safe though.
Regards, Júlio.
comment:3 by , 9 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Added a unit test to confirm that a fix has been made to Boost.Optional and that the use-case now works as expected when using optional with the indirected adapter.
comment:4 by , 5 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
This doesn't appear to be fixed; I've tried the testcase using the latest Boost (1.65.1) with both clang 4.01 and gcc 6.4.1, but still get the compilation failure:
boost_1_65_1/boost/pointee.hpp:30:27: error: no type named 'element_type' in 'boost::optional<int>'
This was apparently known back in May in a question on Stack Overflow, which also mentions a workaround for Boost.Optional. It doesn't address the underlying doc bug though, so the ticket is still valid.