proxygen
folly::gen::detail::Yield< Value, Source > Class Template Reference

#include <Base-inl.h>

Inheritance diagram for folly::gen::detail::Yield< Value, Source >:
folly::gen::GenImpl< Value, Yield< Value, Source > > folly::gen::FBounded< Self >

Public Member Functions

 Yield (Source source)
 
template<class Handler >
bool apply (Handler &&handler) const
 
template<class Body >
void foreach (Body &&body) const
 
- Public Member Functions inherited from folly::gen::GenImpl< Value, Yield< Value, Source > >
bool apply (Handler &&handler) const
 
void foreach (Body &&body) const
 
- Public Member Functions inherited from folly::gen::FBounded< Self >
const Self & self () const
 
Self & self ()
 

Private Attributes

Source source_
 

Additional Inherited Members

- Public Types inherited from folly::gen::GenImpl< Value, Yield< Value, Source > >
typedef Value ValueType
 
typedef std::decay< Value >::type StorageType
 
- Static Public Attributes inherited from folly::gen::GenImpl< Value, Yield< Value, Source > >
static constexpr bool infinite
 
- Protected Member Functions inherited from folly::gen::GenImpl< Value, Yield< Value, Source > >
 GenImpl ()=default
 
 GenImpl (GenImpl &&)=default
 
 GenImpl (const GenImpl &)=default
 
GenImploperator= (GenImpl &&)=default
 
GenImploperator= (const GenImpl &)=default
 

Detailed Description

template<class Value, class Source>
class folly::gen::detail::Yield< Value, Source >

Yield - For producing values from a user-defined generator by way of a 'yield' function.

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

Constructor & Destructor Documentation

template<class Value , class Source >
folly::gen::detail::Yield< Value, Source >::Yield ( Source  source)
inlineexplicit

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

410 : source_(std::move(source)) {}
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567

Member Function Documentation

template<class Value , class Source >
template<class Handler >
bool folly::gen::detail::Yield< Value, Source >::apply ( Handler &&  handler) const
inline

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

References handler(), value, and testing::Value().

413  {
414  struct Break {};
415  auto body = [&](Value value) {
416  if (!handler(std::forward<Value>(value))) {
417  throw Break();
418  }
419  };
420  try {
421  source_(body);
422  return true;
423  } catch (Break&) {
424  return false;
425  }
426  }
void handler(int, siginfo_t *, void *)
bool Value(const T &value, M matcher)
uint64_t value(const typename LockFreeRingBuffer< T, Atom >::Cursor &rbcursor)
template<class Value , class Source >
template<class Body >
void folly::gen::detail::Yield< Value, Source >::foreach ( Body &&  body) const
inline

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

429  {
430  source_(std::forward<Body>(body));
431  }

Member Data Documentation

template<class Value , class Source >
Source folly::gen::detail::Yield< Value, Source >::source_
private

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


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