Home | Libraries | People | FAQ | More |
Syntax |
Code |
---|---|
Pipe |
|
Function |
|
This adaptor produces a range than applies .get()
on all values in the range. It is useful for iterating ranges of std::reference_wrapper
values or values
using similar semantics.
The adaptor is C++11 (and above) only.
value_type
of the range has a
.get() const
.
x
in the returned
range, x
is the result
of y.get()
where y
is the corresponding
element in the original range.
boost::unwrap_ref_range<decltype(rng)>
rng
.
#include <boost/range/adaptor/ref_unwrapped.hpp> #include <iostream> #include <vector> struct example { int value; }; int main(int argc, const char* argv[]) { using boost::adaptors::ref_unwrapped; example one{1}; example two{2}; example three{3}; std::vector<std::reference_wrapper<example> > input{one, two, three}; for (auto&& entry : input | ref_unwrapped) { std::cout << entry.value; } return 0; }
This would produce the output 123
.