std::ranges::transform_view<V,F>::iterator::base - cppreference.com (original) (raw)
Returns the underlying iterator.
Returns a reference to the underlying iterator.
Move constructs the result from the underlying iterator.
[edit] Parameters
(none)
[edit] Return value
A reference to the underlying iterator.
An iterator move constructed from the underlying iterator.
[edit] Example
#include #include #include #include int main() { const auto v = { 0, 1, 2, 3, 4 }; auto x2 = [](int x) { return x << 1; }; std::ranges::transform_view tv{ v, x2 }; std::ostream_iterator ostr{ std::cout, " " }; std::ranges::copy(v, ostr), std::cout << '\n'; std::ranges::copy(tv.base(), ostr), std::cout << '\n'; std::ranges::copy(tv, ostr), std::cout << '\n'; }
Output:
0 1 2 3 4 0 1 2 3 4 0 2 4 6 8
[edit] Defect reports
The following behavior-changing defect reports were applied retroactively to previously published C++ standards.
| DR | Applied to | Behavior as published | Correct behavior |
|---|---|---|---|
| LWG 3533 | C++20 | the const& overload of base returns a copy of the underlying iterator | returns a reference |
| LWG 3593 | C++20 | the const& overload of base might not be noexcept | made noexcept |