| ||||||||||||||||||||||
| Range primitives | |||||||
| |||||||
| Range concepts | |||||||||||||||||||
| |||||||||||||||||||
| Range factories | |||||||||
| |||||||||
| Range adaptors | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Helper items | |||||||||||||||||
| |||||||||||||||||
| Member functions | ||||
(C++26) | ||||
| Deduction guides | ||||
| Iterator | ||||
transform_view::iterator::base | ||||
| Sentinel | ||||
constexprconstranges::iterator_t<Base>& base()const&noexcept; | (1) | (since C++20) |
constexprranges::iterator_t<Base> base()&&; | (2) | (since C++20) |
Returns the underlying iterator.
Contents |
(none)
#include <algorithm>#include <iostream>#include <iterator>#include <ranges> int main(){constauto v={0,1,2,3,4};auto x2=[](int x){return x<<1;}; std::ranges::transform_view tv{ v, x2};std::ostream_iterator<int> 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 40 1 2 3 40 2 4 6 8
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 | theconst& overload ofbase returns a copy of the underlying iterator | returns a reference |
| LWG 3593 | C++20 | theconst& overload ofbase might not be noexcept | made noexcept |