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

#include <ParallelMap-inl.h>

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

Classes

class  Generator
 

Public Member Functions

 PMap ()=default
 
 PMap (Predicate pred, size_t nThreads)
 
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< PMap< 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_
 
size_t nThreads_
 

Additional Inherited Members

- Protected Member Functions inherited from folly::gen::Operator< PMap< 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::PMap< Predicate >

PMap - Map in parallel (using threads). For producing a sequence of values by passing each value from a source collection through a predicate while running the predicate in parallel in different threads.

This type is usually used through the 'pmap' helper function:

auto squares = seq(1, 10) | pmap(fibonacci, 4) | sum;

Definition at line 47 of file ParallelMap-inl.h.

Constructor & Destructor Documentation

template<class Predicate >
folly::gen::detail::PMap< Predicate >::PMap ( )
default
template<class Predicate >
folly::gen::detail::PMap< Predicate >::PMap ( Predicate  pred,
size_t  nThreads 
)
inline

Definition at line 54 of file ParallelMap-inl.h.

References type, and testing::Value().

55  : pred_(std::move(pred)), nThreads_(nThreads) {}
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::PMap< Predicate >::compose ( GenImpl< Value, Source > &&  source) const
inline

Definition at line 242 of file ParallelMap-inl.h.

References folly::gen::move.

242  {
243  return Gen(std::move(source.self()), pred_, nThreads_);
244  }
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::PMap< Predicate >::compose ( const GenImpl< Value, Source > &  source) const
inline

Member Data Documentation

template<class Predicate >
size_t folly::gen::detail::PMap< Predicate >::nThreads_
private

Definition at line 49 of file ParallelMap-inl.h.

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

Definition at line 48 of file ParallelMap-inl.h.


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