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::drop_while_view::drop_while_view(3) C++ Standard Libary std::ranges::drop_while_view::drop_while_view(3)

std::ranges::drop_while_view::drop_while_view - std::ranges::drop_while_view::drop_while_view


drop_while_view() requires std::default_initializable<V> && (1) (since C++20)
std::default_initializable<Pred> = default;
constexpr drop_while_view( V base, Pred pred ); (2) (since C++20)


Constructs a drop_while_view.


1) Default constructor. Value-initializes the underlying view and the predicate.
2) Move constructs the underlying view from base and the predicate from pred.


base - underlying view
pred - predicate

// Run this code


#include <array>
#include <iostream>
#include <ranges>


int main()
{
constexpr std::array data{ 0, -1, -2, 3, 1, 4, 1, 5, };


auto view = std::ranges::drop_while_view{
data, [](int x) { return x <= 0; }
};


for (int x: view) {
std::cout << x << ' ';
}
std::cout << '\n';
}


3 1 4 1 5


Defect reports


The following behavior-changing defect reports were applied retroactively to
previously published C++ standards.


DR Applied to Behavior as published Correct behavior
if Pred is not default_initializable,
P2325R3 C++20 the default constructor the drop_while_view is also
constructs a drop_while_view which not default_initializable
does not contain an Pred

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.