proxygen
folly::gen::detail::Sequence< Value, SequenceImpl > Class Template Reference

#include <Base-inl.h>

Inheritance diagram for folly::gen::detail::Sequence< Value, SequenceImpl >:
folly::gen::GenImpl< const Value &, Sequence< Value, SequenceImpl > > folly::gen::FBounded< Self >

Public Member Functions

 Sequence (Value start, SequenceImpl impl)
 
template<class Handler >
bool apply (Handler &&handler) const
 
template<class Body >
void foreach (Body &&body) const
 
- Public Member Functions inherited from folly::gen::GenImpl< const Value &, Sequence< Value, SequenceImpl > >
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 ()
 

Static Public Attributes

static constexpr bool infinite = SequenceImpl::infinite
 
- Static Public Attributes inherited from folly::gen::GenImpl< const Value &, Sequence< Value, SequenceImpl > >
static constexpr bool infinite
 

Private Attributes

Value start_
 
SequenceImpl impl_
 

Additional Inherited Members

- Public Types inherited from folly::gen::GenImpl< const Value &, Sequence< Value, SequenceImpl > >
typedef const Value & ValueType
 
typedef std::decay< const Value & >::type StorageType
 
- Protected Member Functions inherited from folly::gen::GenImpl< const Value &, Sequence< Value, SequenceImpl > >
 GenImpl ()=default
 
 GenImpl (GenImpl &&)=default
 
 GenImpl (const GenImpl &)=default
 
GenImploperator= (GenImpl &&)=default
 
GenImploperator= (const GenImpl &)=default
 

Detailed Description

template<class Value, class SequenceImpl>
class folly::gen::detail::Sequence< Value, SequenceImpl >

Sequence - For generating values from beginning value, incremented along the way with the ++ and += operators. Iteration may continue indefinitely. Value type specified explicitly.

This type is primarily used through the 'seq' and 'range' function, like:

int total = seq(1, 10) | sum; auto indexes = range(0, 10); auto endless = seq(0); // 0, 1, 2, 3, ...

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

Constructor & Destructor Documentation

template<class Value , class SequenceImpl >
folly::gen::detail::Sequence< Value, SequenceImpl >::Sequence ( Value  start,
SequenceImpl  impl 
)
inlineexplicit

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

288  : start_(std::move(start)), impl_(std::move(impl)) {}
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
auto start

Member Function Documentation

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

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

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

291  {
292  for (Value current = start_; impl_.test(current); impl_.step(current)) {
293  if (!handler(current)) {
294  return false;
295  }
296  }
297  return true;
298  }
void handler(int, siginfo_t *, void *)
int current
bool Value(const T &value, M matcher)
template<class Value , class SequenceImpl >
template<class Body >
void folly::gen::detail::Sequence< Value, SequenceImpl >::foreach ( Body &&  body) const
inline

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

References current, and testing::Value().

301  {
302  for (Value current = start_; impl_.test(current); impl_.step(current)) {
303  body(current);
304  }
305  }
int current
bool Value(const T &value, M matcher)

Member Data Documentation

template<class Value , class SequenceImpl >
SequenceImpl folly::gen::detail::Sequence< Value, SequenceImpl >::impl_
private

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

template<class Value , class SequenceImpl >
constexpr bool folly::gen::detail::Sequence< Value, SequenceImpl >::infinite = SequenceImpl::infinite
static

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

template<class Value , class SequenceImpl >
Value folly::gen::detail::Sequence< Value, SequenceImpl >::start_
private

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


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