proxygen
folly::gen::detail::Filter< Predicate > Class Template Reference

#include <Base-inl.h>

Inheritance diagram for folly::gen::detail::Filter< Predicate >:
folly::gen::Operator< Filter< Predicate > > folly::gen::FBounded< Self >

Classes

class  Generator
 

Public Member Functions

 Filter ()=default
 
 Filter (Predicate pred)
 
template<class Source , class Value , class Gen = Generator<Value, Source>>
Gen compose (GenImpl< Value, Source > &&source) const
 
template<class Source , class Value , class Gen = Generator<Value, Source>>
Gen compose (const GenImpl< Value, Source > &source) const
 
- Public Member Functions inherited from folly::gen::Operator< Filter< Predicate > >
ResultGen compose (const GenImpl< Value, Source > &source) const
 
- Public Member Functions inherited from folly::gen::FBounded< Self >
const Self & self () const
 
Self & self ()
 

Private Attributes

Predicate pred_
 

Additional Inherited Members

- Protected Member Functions inherited from folly::gen::Operator< Filter< Predicate > >
 Operator ()=default
 
 Operator (Operator &&) noexcept=default
 
 Operator (const Operator &)=default
 
Operatoroperator= (Operator &&) noexcept=default
 
Operatoroperator= (const Operator &)=default
 

Detailed Description

template<class Predicate>
class folly::gen::detail::Filter< Predicate >

Filter - For filtering values from a source sequence by a predicate.

This type is usually used through the 'filter' helper function, like:

auto nonEmpty = from(strings) | filter([](const string& str) -> bool { return !str.empty(); });

Note that if no predicate is provided, the values are casted to bool and filtered based on that. So if pointers is a vector of pointers,

auto nonNull = from(pointers) | filter();

will give a vector of all the pointers != nullptr.

Definition at line 576 of file Base-inl.h.

Constructor & Destructor Documentation

template<class Predicate>
folly::gen::detail::Filter< Predicate >::Filter ( )
default
template<class Predicate>
folly::gen::detail::Filter< Predicate >::Filter ( Predicate  pred)
inlineexplicit

Definition at line 581 of file Base-inl.h.

581 : pred_(std::move(pred)) {}
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567

Member Function Documentation

template<class Predicate>
template<class Source , class Value , class Gen = Generator<Value, Source>>
Gen folly::gen::detail::Filter< Predicate >::compose ( GenImpl< Value, Source > &&  source) const
inline

Definition at line 617 of file Base-inl.h.

References folly::gen::move.

617  {
618  return Gen(std::move(source.self()), pred_);
619  }
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
template<class Predicate>
template<class Source , class Value , class Gen = Generator<Value, Source>>
Gen folly::gen::detail::Filter< Predicate >::compose ( const GenImpl< Value, Source > &  source) const
inline

Definition at line 622 of file Base-inl.h.

References folly::gen::FBounded< Self >::self().

622  {
623  return Gen(source.self(), pred_);
624  }

Member Data Documentation

template<class Predicate>
Predicate folly::gen::detail::Filter< Predicate >::pred_
private

Definition at line 577 of file Base-inl.h.


The documentation for this class was generated from the following file: