proxygen
folly::gen::detail::Count Class Reference

#include <Base-inl.h>

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

Public Member Functions

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

Additional Inherited Members

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

Detailed Description

Count - for simply counting the items in a collection.

This type is usually used through its singleton, 'count':

auto shortPrimes = seq(1, 100) | filter(isPrime) | count;

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

Constructor & Destructor Documentation

folly::gen::detail::Count::Count ( )
default

Member Function Documentation

template<class Source , class Value >
size_t folly::gen::detail::Count::compose ( const GenImpl< Value, Source > &  source) const
inline

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

References folly::gen::foldl(), and testing::Value().

2136  {
2137  static_assert(!Source::infinite, "Cannot count infinite source");
2138  return foldl(
2139  size_t(0), [](size_t accum, Value /* v */) { return accum + 1; })
2140  .compose(source);
2141  }
FoldLeft foldl(Seed seed=Seed(), Fold fold=Fold())
Definition: Base.h:791
size_t compose(const GenImpl< Value, Source > &source) const
Definition: Base-inl.h:2136
bool Value(const T &value, M matcher)

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