Namespaces
Variants
Actions

std::ranges::views::filter, std::ranges::filter_view

From cppreference.com
< cpp‎ | ranges
 
 
Ranges library
Range adaptors
 
 
Defined in header <ranges>
template< ranges::input_range V,

          std::indirect_unary_predicate<ranges::iterator_t<V>> Pred >
    requires ranges::view<V> && std::is_object_v<Pred>
class filter_view

    : public ranges::view_interface<filter_view<V, Pred>>
(1) (since C++20)
namespace views {

    inline constexpr /* unspecified */ filter = /* unspecified */;

}
(2) (since C++20)
Call signature
template< ranges::viewable_range R, class Pred >

    requires /* see below */

constexpr ranges::view auto filter( R&& r, Pred&& pred );
(since C++20)
template< class Pred >
constexpr /* range adaptor closure */ filter( Pred&& pred );
(since C++20)
1) A range adaptor that represents view of an underlying sequence with only the elements that satisfy the predicate.
2) RangeAdaptorObject. The expression views::filter(e, p) is expression-equivalent to filter_view(e, p) for any suitable subexpressions e and p.

filter_view models the concepts bidirectional_range, forward_range, input_range, and common_range when the underlying view V models respective concepts.

Contents

[edit] Data members

Member Description
V base_ the underlying view
(exposition-only member object*)