proxygen
folly::gen::detail::RangeSource< Iterator > Class Template Reference

#include <Base-inl.h>

Inheritance diagram for folly::gen::detail::RangeSource< Iterator >:
folly::gen::GenImpl< Range< Iterator >::reference, RangeSource< Iterator > > folly::gen::FBounded< Self >

Public Member Functions

 RangeSource ()=default
 
 RangeSource (Range< Iterator > range)
 
template<class Handler >
bool apply (Handler &&handler) const
 
template<class Body >
void foreach (Body &&body) const
 
- Public Member Functions inherited from folly::gen::GenImpl< Range< Iterator >::reference, RangeSource< Iterator > >
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 = false
 
- Static Public Attributes inherited from folly::gen::GenImpl< Range< Iterator >::reference, RangeSource< Iterator > >
static constexpr bool infinite
 

Private Attributes

Range< Iterator > range_
 

Additional Inherited Members

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

Detailed Description

template<class Iterator>
class folly::gen::detail::RangeSource< Iterator >

RangeSource - For producing values from a folly::Range. Useful for referring to a slice of some container.

This type is primarily used through the 'from' function, like:

auto rangeSource = from(folly::range(v.begin(), v.end())); auto sum = rangeSource | sum;

Reminder: Be careful not to invalidate iterators when using ranges like this.

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

Constructor & Destructor Documentation

template<class Iterator >
folly::gen::detail::RangeSource< Iterator >::RangeSource ( )
default
template<class Iterator >
folly::gen::detail::RangeSource< Iterator >::RangeSource ( Range< Iterator >  range)
inlineexplicit

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

244 : range_(std::move(range)) {}
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
Range< Iterator > range_
Definition: Base-inl.h:240

Member Function Documentation

template<class Iterator >
template<class Handler >
bool folly::gen::detail::RangeSource< Iterator >::apply ( Handler &&  handler) const
inline

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

References handler(), and value.

247  {
248  for (auto& value : range_) {
249  if (!handler(value)) {
250  return false;
251  }
252  }
253  return true;
254  }
void handler(int, siginfo_t *, void *)
Range< Iterator > range_
Definition: Base-inl.h:240
uint64_t value(const typename LockFreeRingBuffer< T, Atom >::Cursor &rbcursor)
template<class Iterator >
template<class Body >
void folly::gen::detail::RangeSource< Iterator >::foreach ( Body &&  body) const
inline

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

References value.

257  {
258  for (auto& value : range_) {
259  body(value);
260  }
261  }
Range< Iterator > range_
Definition: Base-inl.h:240
uint64_t value(const typename LockFreeRingBuffer< T, Atom >::Cursor &rbcursor)

Member Data Documentation

template<class Iterator >
constexpr bool folly::gen::detail::RangeSource< Iterator >::infinite = false
static

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

template<class Iterator >
Range<Iterator> folly::gen::detail::RangeSource< Iterator >::range_
private

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


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