#pragma once
#define FOLLY_GEN_BASE_H_
#include <algorithm>
#include <functional>
#include <memory>
#include <random>
#include <type_traits>
#include <utility>
#include <vector>
#include <folly/Conv.h>
#include <folly/Optional.h>
#include <folly/Range.h>
#include <folly/Utility.h>
#include <folly/container/Access.h>
#include <folly/gen/Core.h>
namespace folly {
namespace gen {
class Less { … };
class Greater { … };
template <int n>
class Get { … };
template <class Class, class Result>
class MemberFunction { … };
template <class Class, class Result>
class ConstMemberFunction { … };
template <class Class, class FieldType>
class Field { … };
class Move { … };
template <class Predicate>
class Negate { … };
template <class Predicate>
Negate<Predicate> negate(Predicate pred) { … }
template <class Dest>
class Cast { … };
template <class Dest>
class To { … };
template <class Dest>
class TryTo { … };
template <>
class To<StringPiece> { … };
template <class Key, class Value>
class Group;
namespace detail {
template <class Self>
struct FBounded;
template <class Container>
struct ValueTypeOfRange { … };
template <
class Container,
class Value = typename ValueTypeOfRange<Container>::RefType>
class ReferencedSource;
template <
class Value,
class Container = std::vector<typename std::decay<Value>::type>>
class CopiedSource;
template <class Value, class SequenceImpl>
class Sequence;
template <class Value>
class RangeImpl;
template <class Value, class Distance>
class RangeWithStepImpl;
template <class Value>
class SeqImpl;
template <class Value, class Distance>
class SeqWithStepImpl;
template <class Value>
class InfiniteImpl;
template <class Value, class Source>
class Yield;
template <class Value>
class Empty;
template <class Value>
class SingleReference;
template <class Value>
class SingleCopy;
template <class Predicate>
class Map;
template <class Predicate>
class Filter;
template <class Predicate>
class Until;
class Take;
class Stride;
template <class Rand>
class Sample;
class Skip;
template <class Visitor>
class Visit;
template <class Selector, class Comparer = Less>
class Order;
template <class Selector>
class GroupBy;
template <class Selector>
class GroupByAdjacent;
template <class Selector>
class Distinct;
template <class Operators>
class Composer;
template <class Expected>
class TypeAssertion;
class Concat;
class RangeConcat;
template <bool forever>
class Cycle;
class Batch;
class Window;
class Dereference;
class Indirect;
template <class Seed, class Fold>
class FoldLeft;
class First;
template <bool result>
class IsEmpty;
template <class Reducer>
class Reduce;
class Sum;
template <class Selector, class Comparer>
class Min;
template <class Container>
class Collect;
template <
template <class, class> class Collection = std::vector,
template <class> class Allocator = std::allocator>
class CollectTemplate;
template <class Collection>
class Append;
template <class Value>
struct GeneratorBuilder;
template <class Needle>
class Contains;
template <class Exception, class ErrorHandler>
class GuardImpl;
template <class T>
class UnwrapOr;
class Unwrap;
}
template <class Value>
class VirtualGen;
template <class Value>
class VirtualGenMoveOnly;
template <
class Container,
class From = detail::ReferencedSource<const Container>>
From fromConst(const Container& source) { … }
template <class Container, class From = detail::ReferencedSource<Container>>
From from(Container& source) { … }
template <
class Container,
class Value = typename detail::ValueTypeOfRange<Container>::StorageType,
class CopyOf = detail::CopiedSource<Value>>
CopyOf fromCopy(Container&& source) { … }
template <class Value, class From = detail::CopiedSource<Value>>
From from(std::initializer_list<Value> source) { … }
template <
class Container,
class From =
detail::CopiedSource<typename Container::value_type, Container>>
From from(Container&& source) { … }
template <
class Value,
class Impl = detail::RangeImpl<Value>,
class Gen = detail::Sequence<Value, Impl>>
Gen range(Value begin, Value end) { … }
template <
class Value,
class Distance,
class Impl = detail::RangeWithStepImpl<Value, Distance>,
class Gen = detail::Sequence<Value, Impl>>
Gen range(Value begin, Value end, Distance step) { … }
template <
class Value,
class Impl = detail::SeqImpl<Value>,
class Gen = detail::Sequence<Value, Impl>>
Gen seq(Value first, Value last) { … }
template <
class Value,
class Distance,
class Impl = detail::SeqWithStepImpl<Value, Distance>,
class Gen = detail::Sequence<Value, Impl>>
Gen seq(Value first, Value last, Distance step) { … }
template <
class Value,
class Impl = detail::InfiniteImpl<Value>,
class Gen = detail::Sequence<Value, Impl>>
Gen seq(Value first) { … }
template <class Value, class Source, class Yield = detail::Yield<Value, Source>>
Yield generator(Source&& source) { … }
#define GENERATOR(TYPE) …
#define GENERATOR_REF(TYPE) …
template <class Value>
detail::Empty<Value> empty() { … }
template <
class Value,
class Just = typename std::conditional<
std::is_reference<Value>::value,
detail::SingleReference<typename std::remove_reference<Value>::type>,
detail::SingleCopy<Value>>::type>
Just just(Value&& value) { … }
template <class Predicate, class Map = detail::Map<Predicate>>
Map mapped(Predicate pred = Predicate()) { … }
template <class Predicate, class Map = detail::Map<Predicate>>
Map map(Predicate pred = Predicate()) { … }
template <class Operator, class Map = detail::Map<detail::Composer<Operator>>>
Map mapOp(Operator op) { … }
enum MemberType { … };
template <MemberType Constness>
struct ExprIsConst { … };
template <MemberType Constness>
struct ExprIsMutable { … };
template <
MemberType Constness = Const,
class Class,
class Return,
class Mem = ConstMemberFunction<Class, Return>,
class Map = detail::Map<Mem>>
typename std::enable_if<ExprIsConst<Constness>::value, Map>::type member(
Return (Class::*member)() const) { … }
template <
MemberType Constness = Mutable,
class Class,
class Return,
class Mem = MemberFunction<Class, Return>,
class Map = detail::Map<Mem>>
typename std::enable_if<ExprIsMutable<Constness>::value, Map>::type member(
Return (Class::*member)()) { … }
template <
class Class,
class FieldType,
class Field = Field<Class, FieldType>,
class Map = detail::Map<Field>>
Map field(FieldType Class::*field) { … }
template <class Predicate = Identity, class Filter = detail::Filter<Predicate>>
Filter filter(Predicate pred = Predicate()) { … }
template <class Visitor = Ignore, class Visit = detail::Visit<Visitor>>
Visit visit(Visitor visitor = Visitor()) { … }
template <class Predicate = Identity, class Until = detail::Until<Predicate>>
Until until(Predicate pred = Predicate()) { … }
template <
class Predicate = Identity,
class TakeWhile = detail::Until<Negate<Predicate>>>
TakeWhile takeWhile(Predicate pred = Predicate()) { … }
template <
class Selector = Identity,
class Comparer = Less,
class Order = detail::Order<Selector, Comparer>>
Order orderBy(Selector selector = Selector(), Comparer comparer = Comparer()) { … }
template <
class Selector = Identity,
class Order = detail::Order<Selector, Greater>>
Order orderByDescending(Selector selector = Selector()) { … }
template <class Selector = Identity, class GroupBy = detail::GroupBy<Selector>>
GroupBy groupBy(Selector selector = Selector()) { … }
template <
class Selector = Identity,
class GroupByAdjacent = detail::GroupByAdjacent<Selector>>
GroupByAdjacent groupByAdjacent(Selector selector = Selector()) { … }
template <
class Selector = Identity,
class Distinct = detail::Distinct<Selector>>
Distinct distinctBy(Selector selector = Selector()) { … }
template <int n, class Get = detail::Map<Get<n>>>
Get get() { … }
template <class Dest, class Cast = detail::Map<Cast<Dest>>>
Cast eachAs() { … }
template <class Dest, class EachTo = detail::Map<To<Dest>>>
EachTo eachTo() { … }
template <class Dest, class EachTryTo = detail::Map<TryTo<Dest>>>
EachTryTo eachTryTo() { … }
template <class Value>
detail::TypeAssertion<Value> assert_type() { … }
template <
class Predicate = Identity,
class Filter = detail::Filter<Predicate>,
class NotEmpty = detail::IsEmpty<false>,
class Composed = detail::Composed<Filter, NotEmpty>>
Composed any(Predicate pred = Predicate()) { … }
template <
class Predicate = Identity,
class Filter = detail::Filter<Negate<Predicate>>,
class IsEmpty = detail::IsEmpty<true>,
class Composed = detail::Composed<Filter, IsEmpty>>
Composed all(Predicate pred = Predicate()) { … }
template <class Seed, class Fold, class FoldLeft = detail::FoldLeft<Seed, Fold>>
FoldLeft foldl(Seed seed = Seed(), Fold fold = Fold()) { … }
template <class Reducer, class Reduce = detail::Reduce<Reducer>>
Reduce reduce(Reducer reducer = Reducer()) { … }
template <class Selector = Identity, class Min = detail::Min<Selector, Less>>
Min minBy(Selector selector = Selector()) { … }
template <class Selector, class MaxBy = detail::Min<Selector, Greater>>
MaxBy maxBy(Selector selector = Selector()) { … }
template <class Collection, class Collect = detail::Collect<Collection>>
Collect as() { … }
template <
template <class, class> class Container = std::vector,
template <class> class Allocator = std::allocator,
class Collect = detail::CollectTemplate<Container, Allocator>>
Collect as() { … }
template <class Collection, class Append = detail::Append<Collection>>
Append appendTo(Collection& collection) { … }
template <
class Needle,
class Contains = detail::Contains<typename std::decay<Needle>::type>>
Contains contains(Needle&& needle) { … }
template <
class Exception,
class ErrorHandler,
class GuardImpl =
detail::GuardImpl<Exception, typename std::decay<ErrorHandler>::type>>
GuardImpl guard(ErrorHandler&& handler) { … }
template <
class Fallback,
class UnwrapOr = detail::UnwrapOr<typename std::decay<Fallback>::type>>
UnwrapOr unwrapOr(Fallback&& fallback) { … }
}
}
#include <folly/gen/Base-inl.h>