proxygen
folly::gen::detail::CollectTemplate< Container, Allocator > Class Template Reference

#include <Base-inl.h>

Inheritance diagram for folly::gen::detail::CollectTemplate< Container, Allocator >:
folly::gen::Operator< CollectTemplate< Container, Allocator > > folly::gen::FBounded< Self >

Public Member Functions

 CollectTemplate ()=default
 
template<class Value , class Source , class StorageType = typename std::decay<Value>::type, class Collection = Container<StorageType, Allocator<StorageType>>>
Collection compose (const GenImpl< Value, Source > &source) const
 
- Public Member Functions inherited from folly::gen::Operator< CollectTemplate< Container, Allocator > >
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< CollectTemplate< Container, Allocator > >
 Operator ()=default
 
 Operator (Operator &&) noexcept=default
 
 Operator (const Operator &)=default
 
Operatoroperator= (Operator &&) noexcept=default
 
Operatoroperator= (const Operator &)=default
 

Detailed Description

template<template< class, class > class Container, template< class > class Allocator>
class folly::gen::detail::CollectTemplate< Container, Allocator >

CollectTemplate - For collecting values from a source in a collection constructed using the specified template type. Given the type of values produced by the given generator, the collection type will be: Container<Value, Allocator<Value>>

The allocator defaults to std::allocator, so this may be used for the STL containers by simply using operators like 'as<set>', 'as<deque>', 'as<vector>'. 'as', here is the helper method which is the usual means of constructing this operator.

Example:

set<string> uniqueNames = from(names) | as<set>();

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

Constructor & Destructor Documentation

template<template< class, class > class Container, template< class > class Allocator>
folly::gen::detail::CollectTemplate< Container, Allocator >::CollectTemplate ( )
default

Member Function Documentation

template<template< class, class > class Container, template< class > class Allocator>
template<class Value , class Source , class StorageType = typename std::decay<Value>::type, class Collection = Container<StorageType, Allocator<StorageType>>>
Collection folly::gen::detail::CollectTemplate< Container, Allocator >::compose ( const GenImpl< Value, Source > &  source) const
inline

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

References v, and testing::Value().

2340  {
2341  static_assert(
2342  !Source::infinite, "Cannot convert infinite source to object with as.");
2343  Collection collection;
2344  source | [&](Value v) {
2345  collection.insert(collection.end(), std::forward<Value>(v));
2346  };
2347  return collection;
2348  }
auto v
bool Value(const T &value, M matcher)

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