Brian Silverman | 598d029 | 2018-08-04 23:56:47 -0700 | [diff] [blame^] | 1 | [/ |
| 2 | Copyright 2015 Robin Eckert |
| 3 | Distributed under the Boost Software License, Version 1.0. |
| 4 | (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |
| 5 | /] |
| 6 | [section:ref_unwrapped ref_unwrapped] |
| 7 | |
| 8 | [table |
| 9 | [[Syntax] [Code]] |
| 10 | [[Pipe] [`rng | boost::adaptors::ref_unwrapped`]] |
| 11 | [[Function] [`boost::adaptors::ref_unwrap(rng)`]] |
| 12 | ] |
| 13 | |
| 14 | This adaptor produces a range than applies `.get()` on all values in |
| 15 | the range. It is useful for iterating ranges of |
| 16 | `std::reference_wrapper` values or values using similar semantics. |
| 17 | |
| 18 | The adaptor is C++11 (and above) only. |
| 19 | |
| 20 | * [*Precondition:] The `value_type` of the range has a `.get() const`. |
| 21 | * [*Postcondition:] For all elements `x` in the returned range, `x` is the result of `y.get()` where `y` is the corresponding element in the original range. |
| 22 | * [*Range Category:] __single_pass_range__ |
| 23 | * [*Range Return Type:] `boost::unwrap_ref_range<decltype(rng)>` |
| 24 | * [*Returned Range Category:] The range category of `rng`. |
| 25 | |
| 26 | [section:ref_unwrapped_example ref_unwrapped example] |
| 27 | [import ../../../test/adaptor_test/ref_unwrapped_example.cpp] |
| 28 | [ref_unwrapped_example] |
| 29 | [endsect] |
| 30 | |
| 31 | This would produce the output `123`. |
| 32 | [endsect] |