proxygen
folly::gen::detail::GroupByAdjacent< Selector > Class Template Reference

#include <Base-inl.h>

Inheritance diagram for folly::gen::detail::GroupByAdjacent< Selector >:
folly::gen::Operator< GroupByAdjacent< Selector > > folly::gen::FBounded< Self >

Classes

class  Generator
 

Public Member Functions

 GroupByAdjacent ()
 
 GroupByAdjacent (Selector selector)
 
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< GroupByAdjacent< Selector > >
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

Selector selector_
 

Additional Inherited Members

- Protected Member Functions inherited from folly::gen::Operator< GroupByAdjacent< Selector > >
 Operator ()=default
 
 Operator (Operator &&) noexcept=default
 
 Operator (const Operator &)=default
 
Operatoroperator= (Operator &&) noexcept=default
 
Operatoroperator= (const Operator &)=default
 

Detailed Description

template<class Selector>
class folly::gen::detail::GroupByAdjacent< Selector >

GroupByAdjacent - Group adjacent values by a given key selector, producing a sequence of groups. This differs from GroupBy in that only contiguous sets of values with the same key are considered part of the same group. Unlike GroupBy, this can be used on infinite sequences.

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

auto tens = seq(0) | groupByAdjacent([](int i){ return (i / 10) % 2; })

This example results in a list like [ 0:[0-9], 1:[10-19], 0:[20-29], ... ]

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

Constructor & Destructor Documentation

template<class Selector >
folly::gen::detail::GroupByAdjacent< Selector >::GroupByAdjacent ( )
inline

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

1225 {}
template<class Selector >
folly::gen::detail::GroupByAdjacent< Selector >::GroupByAdjacent ( Selector  selector)
inlineexplicit

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

References testing::Key(), type, and testing::Value().

1228  : selector_(std::move(selector)) {}
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567

Member Function Documentation

template<class Selector >
template<class Source , class Value , class Gen = Generator<Value, Source>>
Gen folly::gen::detail::GroupByAdjacent< Selector >::compose ( GenImpl< Value, Source > &&  source) const
inline

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

References folly::gen::move.

1297  {
1298  return Gen(std::move(source.self()), selector_);
1299  }
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
template<class Selector >
template<class Source , class Value , class Gen = Generator<Value, Source>>
Gen folly::gen::detail::GroupByAdjacent< Selector >::compose ( const GenImpl< Value, Source > &  source) const
inline

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

References folly::gen::FBounded< Self >::self().

1302  {
1303  return Gen(source.self(), selector_);
1304  }

Member Data Documentation

template<class Selector >
Selector folly::gen::detail::GroupByAdjacent< Selector >::selector_
private

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


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