GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
std::ranges::transform_view::iterator::base(3) C++ Standard Libary std::ranges::transform_view::iterator::base(3)

std::ranges::transform_view::iterator::base - std::ranges::transform_view::iterator::base


constexpr const ranges::iterator_t<Base>& base() const & noexcept; (1) (since C++20)
constexpr ranges::iterator_t<Base> base() &&; (2) (since C++20)


Returns the underlying iterator.


1) Returns a reference to the underlying iterator.
2) Move constructs the result from the underlying iterator.


(none)


1) A reference to the underlying iterator.
2) An iterator move constructed from the underlying iterator.

// Run this code


#include <algorithm>
#include <iostream>
#include <iterator>
#include <ranges>


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<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';
}


0 1 2 3 4
0 1 2 3 4
0 2 4 6 8


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 returns a reference
of the underlying iterator
LWG 3593 C++20 the const& overload of base might not be made noexcept
noexcept

2022.07.31 http://cppreference.com

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.