17 #ifndef FOLLY_GEN_BASE_H_ 18 #error This file may only be included from folly/gen/Base.h 36 std::is_reference<T>::value,
38 typename std::conditional<
39 std::is_const<T>::value,
47 template <
class Key,
class Value>
52 "Key and Value must be decayed types");
66 return values_.size();
84 void foreach(Body&& body)
const {
85 for (
auto&
value : values_) {
90 template <
class Handler>
92 for (
auto&
value : values_) {
101 static constexpr
bool infinite =
false;
128 template <
class Container,
class Value>
130 :
public GenImpl<Value, ReferencedSource<Container, Value>> {
136 template <
class Body>
137 void foreach(Body&& body)
const {
138 for (
auto&
value : *container_) {
139 body(std::forward<Value>(
value));
143 template <
class Handler>
145 for (
auto&
value : *container_) {
154 static constexpr
bool infinite =
false;
171 template <
class StorageType,
class Container>
173 :
public GenImpl<const StorageType&, CopiedSource<StorageType, Container>> {
176 "StorageType must be decayed");
186 "Can't copy into a reference");
187 std::shared_ptr<const Container>
copy_;
192 template <
class SourceContainer>
194 : copy_(new Container(
begin(container),
end(container))) {}
197 : copy_(new Container(
std::
move(container))) {}
201 : copy_(source.copy_) {}
203 template <
class Body>
204 void foreach(Body&& body)
const {
205 for (
const auto&
value : *copy_) {
210 template <
class Handler>
213 for (
const auto&
value : *copy_) {
222 static constexpr
bool infinite =
false;
236 template <
class Iterator>
238 typename Range<Iterator>::reference,
239 RangeSource<Iterator>> {
246 template <
class Handler>
248 for (
auto&
value : range_) {
256 template <
class Body>
257 void foreach(Body&& body)
const {
258 for (
auto&
value : range_) {
264 static constexpr
bool infinite =
false;
278 template <
class Value,
class SequenceImpl>
282 "Value mustn't be const or ref.");
290 template <
class Handler>
300 template <
class Body>
301 void foreach(Body&& body)
const {
308 static constexpr
bool infinite = SequenceImpl::infinite;
314 template <
class Value>
321 return current <
end_;
326 static constexpr
bool infinite =
false;
329 template <
class Value,
class Distance>
338 return current <
end_;
343 static constexpr
bool infinite =
false;
346 template <
class Value>
353 return current <=
end_;
358 static constexpr
bool infinite =
false;
361 template <
class Value,
class Distance>
370 return current <=
end_;
375 static constexpr
bool infinite =
false;
378 template <
class Value>
387 static constexpr
bool infinite =
true;
393 template <
class Value>
395 template <
class Source,
class Yield = detail::Yield<Value, Source>>
397 return Yield(std::forward<Source>(source));
405 template <
class Value,
class Source>
412 template <
class Handler>
428 template <
class Body>
429 void foreach(Body&& body)
const {
430 source_(std::forward<Body>(body));
434 template <
class Value>
437 template <
class Handler>
442 template <
class Body>
443 void foreach(Body&&)
const {}
446 static constexpr
bool infinite =
false;
449 template <
class Value>
453 "SingleReference requires non-ref types");
459 template <
class Handler>
464 template <
class Body>
465 void foreach(Body&& body)
const {
470 static constexpr
bool infinite =
false;
473 template <
class Value>
477 "SingleCopy requires non-ref types");
483 template <
class Handler>
488 template <
class Body>
489 void foreach(Body&& body)
const {
494 static constexpr
bool infinite =
false;
509 template <
class Predicate>
528 explicit Generator(Source source,
const Predicate& pred)
529 : source_(
std::
move(source)), pred_(pred) {}
531 template <
class Body>
532 void foreach(Body&& body)
const {
534 [&](
Value value) { body(pred_(std::forward<Value>(value))); });
537 template <
class Handler>
540 return handler(pred_(std::forward<Value>(value)));
544 static constexpr
bool infinite = Source::infinite;
547 template <
class Source,
class Value,
class Gen = Generator<Value, Source>>
549 return Gen(
std::move(source.self()), pred_);
552 template <
class Source,
class Value,
class Gen = Generator<Value, Source>>
554 return Gen(source.
self(), pred_);
575 template <
class Predicate>
583 template <
class Value,
class Source>
589 explicit Generator(Source source,
const Predicate& pred)
590 : source_(
std::
move(source)), pred_(pred) {}
592 template <
class Body>
593 void foreach(Body&& body)
const {
597 body(std::forward<Value>(value));
602 template <
class Handler>
604 return source_.apply([&](
Value value) ->
bool {
607 return handler(std::forward<Value>(value));
613 static constexpr
bool infinite = Source::infinite;
616 template <
class Source,
class Value,
class Gen = Generator<Value, Source>>
618 return Gen(
std::move(source.self()), pred_);
621 template <
class Source,
class Value,
class Gen = Generator<Value, Source>>
623 return Gen(source.
self(), pred_);
636 template <
class Predicate>
644 template <
class Value,
class Source>
650 explicit Generator(Source source,
const Predicate& pred)
651 : source_(
std::
move(source)), pred_(pred) {}
653 template <
class Handler>
655 bool cancelled =
false;
660 if (!
handler(std::forward<Value>(value))) {
670 static constexpr
bool infinite =
false;
673 template <
class Source,
class Value,
class Gen = Generator<Value, Source>>
675 return Gen(
std::move(source.self()), pred_);
678 template <
class Source,
class Value,
class Gen = Generator<Value, Source>>
680 return Gen(source.
self(), pred_);
699 template <
class Value,
class Source>
706 : source_(
std::
move(source)), count_(count) {}
708 template <
class Handler>
714 bool cancelled =
false;
716 if (!
handler(std::forward<Value>(value))) {
726 static constexpr
bool infinite =
false;
729 template <
class Source,
class Value,
class Gen = Generator<Value, Source>>
731 return Gen(
std::move(source.self()), count_);
734 template <
class Source,
class Value,
class Gen = Generator<Value, Source>>
736 return Gen(source.
self(), count_);
751 template <
class Visitor>
760 template <
class Value,
class Source>
766 explicit Generator(Source source,
const Visitor& visitor)
767 : source_(
std::
move(source)), visitor_(visitor) {}
769 template <
class Body>
770 void foreach(Body&& body)
const {
773 body(std::forward<Value>(value));
777 template <
class Handler>
781 return handler(std::forward<Value>(value));
785 static constexpr
bool infinite = Source::infinite;
788 template <
class Source,
class Value,
class Gen = Generator<Value, Source>>
790 return Gen(
std::move(source.self()), visitor_);
793 template <
class Source,
class Value,
class Gen = Generator<Value, Source>>
795 return Gen(source.
self(), visitor_);
813 throw std::invalid_argument(
"stride must not be 0");
817 template <
class Value,
class Source>
824 : source_(
std::
move(source)), stride_(stride) {}
826 template <
class Handler>
828 size_t distance = stride_;
829 return source_.apply([&](
Value value) ->
bool {
830 if (++distance >= stride_) {
831 if (!
handler(std::forward<Value>(value))) {
840 template <
class Body>
841 void foreach(Body&& body)
const {
842 size_t distance = stride_;
844 if (++distance >= stride_) {
845 body(std::forward<Value>(value));
852 static constexpr
bool infinite = Source::infinite;
855 template <
class Source,
class Value,
class Gen = Generator<Value, Source>>
857 return Gen(
std::move(source.self()), stride_);
860 template <
class Source,
class Value,
class Gen = Generator<Value, Source>>
862 return Gen(source.
self(), stride_);
870 template <
class Random>
877 : count_(count), rng_(
std::
move(rng)) {}
886 Generator<Value, Source, Rand, StorageType>> {
887 static_assert(!Source::infinite,
"Cannot sample infinite source!");
891 "Random number generator must support big values");
898 : source_(
std::
move(source)), count_(count), rng_(
std::
move(rng)) {}
900 template <
class Handler>
905 std::vector<StorageType>
v;
911 if (v.size() < count_) {
912 v.push_back(std::forward<Value>(value));
917 size_t index = rng_() % n;
918 if (index < v.size()) {
919 v[index] = std::forward<Value>(
value);
926 for (
auto&
val : v) {
935 static constexpr
bool infinite =
false;
943 return Gen(
std::move(source.self()), count_, rng_);
951 return Gen(source.
self(), count_, rng_);
970 template <
class Value,
class Source>
977 : source_(
std::
move(source)), count_(count) {}
979 template <
class Body>
980 void foreach(Body&& body)
const {
982 source_.foreach(body);
990 body(std::forward<Value>(value));
995 template <
class Handler>
998 return source_.apply(std::forward<Handler>(
handler));
1001 return source_.apply([&](
Value value) ->
bool {
1006 return handler(std::forward<Value>(value));
1011 static constexpr
bool infinite = Source::infinite;
1014 template <
class Source,
class Value,
class Gen = Generator<Value, Source>>
1016 return Gen(
std::move(source.self()), count_);
1019 template <
class Source,
class Value,
class Gen = Generator<Value, Source>>
1021 return Gen(source.
self(), count_);
1038 template <
class Selector,
class Comparer>
1048 Order(Selector selector, Comparer comparer)
1049 : selector_(
std::
move(selector)), comparer_(
std::
move(comparer)) {}
1058 Generator<Value, Source, StorageType, Result>> {
1059 static_assert(!Source::infinite,
"Cannot sort infinite source!");
1067 auto comparer = [&](
const StorageType&
a,
const StorageType&
b) {
1068 return comparer_(selector_(a), selector_(
b));
1070 auto vals = source_ | as<VectorType>();
1071 std::sort(vals.begin(), vals.end(), comparer);
1076 Generator(Source source, Selector selector, Comparer comparer)
1078 selector_(
std::
move(selector)),
1079 comparer_(
std::
move(comparer)) {}
1089 template <
class Body>
1090 void foreach(Body&& body)
const {
1091 for (
auto&
value : asVector()) {
1096 template <
class Handler>
1098 auto comparer = [&](
const StorageType&
a,
const StorageType&
b) {
1100 return comparer_(selector_(
b), selector_(a));
1102 auto heap = source_ | as<VectorType>();
1103 std::make_heap(heap.begin(), heap.end(), comparer);
1104 while (!heap.empty()) {
1105 std::pop_heap(heap.begin(), heap.end(), comparer);
1115 static constexpr
bool infinite =
false;
1118 template <
class Source,
class Value,
class Gen = Generator<Value, Source>>
1120 return Gen(
std::move(source.self()), selector_, comparer_);
1123 template <
class Source,
class Value,
class Gen = Generator<Value, Source>>
1125 return Gen(source.
self(), selector_, comparer_);
1144 template <
class Selector>
1161 Group<KeyDecayed, ValueDecayed>&&,
1162 Generator<Value, Source, ValueDecayed, Key, KeyDecayed>> {
1163 static_assert(!Source::infinite,
"Cannot group infinite source!");
1173 template <
class Handler>
1175 std::unordered_map<KeyDecayed, typename GroupType::VectorType> groups;
1178 auto&
group = groups[selector_(cv)];
1181 for (
auto& kg : groups) {
1192 static constexpr
bool infinite =
false;
1195 template <
class Source,
class Value,
class Gen = Generator<Value, Source>>
1197 return Gen(
std::move(source.self()), selector_);
1200 template <
class Source,
class Value,
class Gen = Generator<Value, Source>>
1202 return Gen(source.
self(), selector_);
1220 template <
class Selector>
1228 : selector_(
std::
move(selector)) {}
1238 Group<KeyDecayed, ValueDecayed>&&,
1239 Generator<Value, Source, ValueDecayed, Key, KeyDecayed>> {
1249 template <
class Handler>
1254 bool result = source_.apply([&](
Value value)
mutable {
1255 KeyDecayed newKey = selector_(value);
1262 if (key == newKey) {
1264 values.push_back(value);
1275 values.push_back(value);
1293 static constexpr
bool infinite = Source::infinite;
1296 template <
class Source,
class Value,
class Gen = Generator<Value, Source>>
1298 return Gen(
std::move(source.self()), selector_);
1301 template <
class Source,
class Value,
class Gen = Generator<Value, Source>>
1303 return Gen(source.
self(), selector_);
1316 template <
class Expected>
1319 template <
class Source,
class Value>
1323 return source.
self();
1326 template <
class Source,
class Value>
1346 template <
class Selector>
1355 template <
class Value,
class Source>
1373 template <
class Body>
1374 void foreach(Body&& body)
const {
1375 std::unordered_set<KeyStorageType> keysSeen;
1377 if (keysSeen.insert(selector_(ParamType(value))).second) {
1378 body(std::forward<Value>(value));
1383 template <
class Handler>
1385 std::unordered_set<KeyStorageType> keysSeen;
1386 return source_.apply([&](
Value value) ->
bool {
1387 if (keysSeen.insert(selector_(ParamType(value))).second) {
1388 return handler(std::forward<Value>(value));
1396 static constexpr
bool infinite = Source::infinite;
1399 template <
class Source,
class Value,
class Gen = Generator<Value, Source>>
1401 return Gen(
std::move(source.self()), selector_);
1404 template <
class Source,
class Value,
class Gen = Generator<Value, Source>>
1406 return Gen(source.
self(), selector_);
1414 template <
class Operators>
1424 decltype(std::declval<Operators>().compose(std::declval<Source>()))>
1426 return op_.compose(std::forward<Source>(source));
1447 explicit Batch(
size_t batchSize) : batchSize_(batchSize) {
1448 if (batchSize_ == 0) {
1449 throw std::invalid_argument(
"Batch size must be non-zero!");
1457 class VectorType = std::vector<StorageType>>
1460 Generator<Value, Source, StorageType, VectorType>> {
1466 : source_(
std::
move(source)), batchSize_(batchSize) {}
1468 template <
class Handler>
1471 batch_.reserve(batchSize_);
1472 bool shouldContinue = source_.apply([&](
Value value) ->
bool {
1473 batch_.push_back(std::forward<Value>(value));
1474 if (batch_.size() == batchSize_) {
1475 bool needMore =
handler(batch_);
1483 if (shouldContinue && !batch_.empty()) {
1484 shouldContinue =
handler(batch_);
1487 return shouldContinue;
1491 static constexpr
bool infinite = Source::infinite;
1494 template <
class Source,
class Value,
class Gen = Generator<Value, Source>>
1496 return Gen(
std::move(source.self()), batchSize_);
1499 template <
class Source,
class Value,
class Gen = Generator<Value, Source>>
1501 return Gen(source.
self(), batchSize_);
1522 explicit Window(
size_t windowSize) : windowSize_(windowSize) {
1523 if (windowSize_ == 0) {
1524 throw std::invalid_argument(
"Window size must be non-zero!");
1533 :
public GenImpl<StorageType&&, Generator<Value, Source, StorageType>> {
1539 : source_(
std::
move(source)), windowSize_(windowSize) {}
1541 template <
class Handler>
1543 std::vector<StorageType>
buffer;
1544 buffer.reserve(windowSize_);
1545 size_t readIndex = 0;
1546 bool shouldContinue = source_.apply([&](
Value value) ->
bool {
1547 if (buffer.size() < windowSize_) {
1548 buffer.push_back(std::forward<Value>(value));
1550 StorageType& entry = buffer[readIndex++];
1551 if (readIndex == windowSize_) {
1557 entry = std::forward<Value>(
value);
1561 if (!shouldContinue) {
1564 if (buffer.size() < windowSize_) {
1565 for (StorageType& entry : buffer) {
1571 for (
size_t i = readIndex;;) {
1572 StorageType& entry = buffer[
i++];
1576 if (
i == windowSize_) {
1579 if (
i == readIndex) {
1588 static constexpr
bool infinite = Source::infinite;
1591 template <
class Source,
class Value,
class Gen = Generator<Value, Source>>
1593 return Gen(
std::move(source.self()), windowSize_);
1596 template <
class Source,
class Value,
class Gen = Generator<Value, Source>>
1598 return Gen(source.
self(), windowSize_);
1625 class InnerValue =
typename std::decay<Inner>::type::ValueType>
1627 :
public GenImpl<InnerValue, Generator<Inner, Source, InnerValue>> {
1633 template <
class Handler>
1635 return source_.apply([&](Inner inner) ->
bool {
1636 return inner.apply(std::forward<Handler>(
handler));
1640 template <
class Body>
1641 void foreach(Body&& body)
const {
1643 [&](Inner inner) { inner.foreach(std::forward<Body>(body)); });
1651 static constexpr
bool infinite =
1652 Source::infinite || std::decay<Inner>::type::infinite;
1655 template <
class Value,
class Source,
class Gen = Generator<Value, Source>>
1660 template <
class Value,
class Source,
class Gen = Generator<Value, Source>>
1662 return Gen(source.
self());
1687 :
public GenImpl<InnerValue, Generator<Range, Source, InnerValue>> {
1693 template <
class Body>
1694 void foreach(Body&& body)
const {
1696 for (
auto&
value : range) {
1702 template <
class Handler>
1704 return source_.apply([&](
Range range) ->
bool {
1705 for (
auto&
value : range) {
1716 static constexpr
bool infinite = Source::infinite;
1719 template <
class Value,
class Source,
class Gen = Generator<Value, Source>>
1724 template <
class Value,
class Source,
class Gen = Generator<Value, Source>>
1726 return Gen(source.
self());
1753 template <
class Exception,
class ErrorHandler>
1760 template <
class Value,
class Source>
1769 template <
class Handler>
1771 return source_.apply([&](
Value value) ->
bool {
1773 handler(std::forward<Value>(value));
1776 return handler_(e, std::forward<Value>(value));
1782 static constexpr
bool infinite = Source::infinite;
1785 template <
class Value,
class Source,
class Gen = Generator<Value, Source>>
1787 return Gen(
std::move(source.self()), handler_);
1790 template <
class Value,
class Source,
class Gen = Generator<Value, Source>>
1792 return Gen(source.
self(), handler_);
1811 class Result = decltype(*std::declval<Value>())>
1818 template <
class Body>
1819 void foreach(Body&& body)
const {
1822 return body(*std::forward<Value>(value));
1827 template <
class Handler>
1829 return source_.apply([&](
Value value) ->
bool {
1831 return handler(*std::forward<Value>(value));
1838 static constexpr
bool infinite = Source::infinite;
1841 template <
class Source,
class Value,
class Gen = Generator<Value, Source>>
1846 template <
class Source,
class Value,
class Gen = Generator<Value, Source>>
1848 return Gen(source.
self());
1872 "Cannot use indirect on an rvalue");
1877 template <
class Body>
1878 void foreach(Body&& body)
const {
1880 [&](
Value value) {
return body(&std::forward<Value>(value)); });
1883 template <
class Handler>
1885 return source_.apply([&](
Value value) ->
bool {
1886 return handler(&std::forward<Value>(value));
1891 static constexpr
bool infinite = Source::infinite;
1894 template <
class Source,
class Value,
class Gen = Generator<Value, Source>>
1899 template <
class Source,
class Value,
class Gen = Generator<Value, Source>>
1901 return Gen(source.
self());
1919 template <
bool forever>
1925 explicit Cycle(off_t limit) : limit_(limit) {
1928 "Cycle limit constructor should not be used when forever == true.");
1931 template <
class Value,
class Source>
1938 : source_(
std::
move(source)), limit_(limit) {}
1940 template <
class Handler>
1950 source_.apply(handler2);
1964 static constexpr
bool infinite =
forever || Source::infinite;
1967 template <
class Source,
class Value,
class Gen = Generator<Value, Source>>
1969 return Gen(
std::move(source.self()), limit_);
1972 template <
class Source,
class Value,
class Gen = Generator<Value, Source>>
1974 return Gen(source.
self(), limit_);
2003 template <
class Seed,
class Fold>
2013 template <
class Source,
class Value>
2015 static_assert(!Source::infinite,
"Cannot foldl infinite source");
2018 accum = fold_(
std::move(accum), std::forward<Value>(
v));
2041 source | [&](Value
v) ->
bool {
2042 accum = std::forward<Value>(
v);
2064 template <
bool emptyResult>
2069 template <
class Source,
class Value>
2073 "Cannot call 'all', 'any', 'isEmpty', or 'notEmpty' on " 2074 "infinite source. 'all' and 'isEmpty' will either return " 2075 "false or hang. 'any' or 'notEmpty' will either return true " 2077 bool ans = emptyResult;
2078 source | [&](
Value ) ->
bool {
2098 template <
class Reducer>
2111 static_assert(!Source::infinite,
"Cannot reduce infinite source");
2113 source | [&](Value
v) {
2115 *target = reducer_(
std::move(*target), std::forward<Value>(
v));
2117 accum = std::forward<Value>(
v);
2135 template <
class Source,
class Value>
2137 static_assert(!Source::infinite,
"Cannot count infinite source");
2139 size_t(0), [](
size_t accum,
Value ) {
return accum + 1; })
2160 static_assert(!Source::infinite,
"Cannot sum infinite source");
2163 [](StorageType&& accum, Value
v) {
2164 return std::move(accum) + std::forward<Value>(
v);
2178 template <
class Needle>
2192 "Calling contains on an infinite source might cause " 2193 "an infinite loop.");
2194 return !(source | [
this](Value
value) {
2195 return !(needle_ == std::forward<Value>(
value));
2212 template <
class Selector,
class Comparer>
2217 template <
typename T>
2225 explicit Min(Selector selector) : selector_(
std::
move(selector)) {}
2227 Min(Selector selector, Comparer comparer)
2228 : selector_(
std::
move(selector)), comparer_(
std::
move(comparer)) {}
2234 class Key =
typename std::decay<invoke_result_t<Selector, Value>>
::type>
2238 "Calling min or max on an infinite source will cause " 2239 "an infinite loop.");
2243 Key key = selector_(asConst(
v));
2245 if (!comparer_(key, *lastKey)) {
2250 min = std::forward<Value>(
v);
2266 template <
class Collection>
2271 explicit Append(Collection* collection) : collection_(collection) {}
2273 template <
class Value,
class Source>
2275 static_assert(!Source::infinite,
"Cannot appendTo with infinite source");
2277 collection_->insert(collection_->end(), std::forward<Value>(
v));
2279 return *collection_;
2293 template <
class Collection>
2304 !Source::infinite,
"Cannot convert infinite source to object with as.");
2305 Collection collection;
2307 collection.insert(collection.end(), std::forward<Value>(
v));
2329 template <
class,
class>
class Container,
2330 template <
class>
class Allocator>
2339 class Collection = Container<StorageType, Allocator<StorageType>>>
2342 !Source::infinite,
"Cannot convert infinite source to object with as.");
2343 Collection collection;
2345 collection.insert(collection.end(), std::forward<Value>(
v));
2381 if (
T* p = opt.get_pointer()) {
2392 return fallback.
value();
2400 return fallback.
value();
2407 class R =
typename std::enable_if<
2411 if (
T* p = opt.get_pointer()) {
2420 class R =
typename std::enable_if<
2433 class R =
typename std::enable_if<
2437 if (T* p = opt.get_pointer()) {
2440 return fallback.
value();
2446 class R =
typename std::enable_if<
2453 return fallback.
value();
2484 template <
class Value>
2490 virtual void foreach(
const std::function<
void(
Value)>& body)
const = 0;
2491 virtual std::unique_ptr<const WrapperBase> clone()
const = 0;
2494 template <
class Wrapped>
2502 return wrapped_.apply(
handler);
2505 void foreach(
const std::function<
void(
Value)>& body)
const override {
2506 wrapped_.foreach(body);
2509 std::unique_ptr<const WrapperBase>
clone()
const override {
2510 return std::unique_ptr<const WrapperBase>(
new WrapperImpl(wrapped_));
2517 template <
class Self>
2522 : wrapper_(
std::
move(source.wrapper_)) {}
2527 wrapper_.reset(source.
wrapper_->clone());
2537 return wrapper_->apply(
handler);
2540 void foreach(
const std::function<
void(
Value)>& body)
const {
2541 wrapper_->foreach(body);
2581 template <
class Number>
2584 throw std::invalid_argument(
"Negative value passed to take()");
2593 template <
class Random = std::default_random_engine>
ReferencedSource(Container *container)
decltype(*std::begin(std::declval< Container & >())) RefType
bool apply(Handler &&handler) const
const T & operator|(const Optional< T > &opt, const Unwrap &)
std::vector< uint8_t > buffer(kBufferSize+16)
std::shared_ptr< const Container > copy_
Order(Selector selector, Comparer comparer)
Group(Key key, VectorType values)
Generator(Source source, ErrorHandler handler)
#define FOLLY_GNU_DISABLE_WARNING(warningName)
#define FOLLY_POP_WARNING
Generator(Source source, off_t limit)
Generator(Source source, const Predicate &pred)
std::atomic< int64_t > sum(0)
bool apply(Handler &&handler) const
Gen compose(GenImpl< Value, Source > &&source) const
Gen compose(const GenImpl< Value, Source > &source) const
VectorType operator|(const detail::CollectTemplate< std::vector > &) const
Gen compose(const GenImpl< Value, Source > &source) const
Gen compose(GenImpl< Value, Source > &&source) const
bool apply(Handler &&handler) const
const VectorType & values() const
typename invoke_result< F, Args... >::type invoke_result_t
Gen compose(const GenImpl< Value, Source > &source) const
#define FOLLY_PUSH_WARNING
VirtualGen & operator=(const VirtualGen &source)
Sequence(Value start, SequenceImpl impl)
bool compose(const GenImpl< Value, Source > &source) const
Seed compose(const GenImpl< Value, Source > &source) const
Gen compose(GenImpl< Value, Source > &&source) const
std::unique_ptr< const WrapperBase > wrapper_
constexpr detail::Count count
bool apply(Handler &&) const
constexpr detail::IsEmpty< false > notEmpty
void step(Value ¤t) const
Gen compose(GenImpl< Value, Source > &&source) const
Gen compose(GenImpl< Value, Source > &&source) const
bool test(const Value ¤t) const
Gen compose(const GenImpl< Value, Source > &source) const
bool apply(Handler &&handler) const
GroupBy(Selector selector)
Yield operator+(Source &&source)
constexpr detail::Map< Move > move
static auto const forever
internal::KeyMatcher< M > Key(M inner_matcher)
Gen compose(GenImpl< Value, Source > &&source) const
constexpr detail::Distinct< Identity > distinct
bool apply(Handler &&handler) const
bool test(const Value ¤t) const
std::vector< Value > VectorType
auto begin(TestAdlIterable &instance)
bool apply(Handler &&handler) const
Gen compose(const GenImpl< Value, Source > &source) const
Group< KeyDecayed, ValueDecayed > GroupType
Gen compose(GenImpl< Value, Source > &&source) const
GroupByAdjacent(Selector selector)
detail::Batch batch(size_t batchSize)
CopiedSource(const CopiedSource< StorageType, Container > &source)
WrapperImpl(Wrapped wrapped)
Gen compose(GenImpl< Value, Source > &&source) const
Generator(Source source, const Predicate &pred)
const StorageType & ParamType
bool test(const Value ¤t) const
—— Concurrent Priority Queue Implementation ——
bool apply(Handler &&handler) const
detail::Skip skip(size_t count)
VectorType operator|(const detail::Collect< VectorType > &) const
requires E e noexcept(noexcept(s.error(std::move(e))))
Generator(Source source, size_t windowSize)
Optional< StorageType > compose(const GenImpl< Value, Source > &source) const
Gen compose(GenImpl< Value, Source > &&source) const
bool apply(Handler &&handler) const
virtual ~WrapperBase() noexcept
detail::Sample< Random > sample(size_t count, Random rng=Random())
Gen compose(const GenImpl< Value, Source > &source) const
SeqWithStepImpl(Value end, Distance step)
std::unordered_map< int64_t, VecT > Map
Collection & compose(const GenImpl< Value, Source > &source) const
Gen compose(GenImpl< Value, Source > &&source) const
Generator(Source source, Selector selector)
VirtualGen(VirtualGen &&source) noexcept
VectorType asVector() const
VectorType operator|(const Collect< VectorType > &) const
bool apply(Handler &&handler) const
bool apply(Handler &&handler) const
const T & asConst(const T &t) const
Sample(size_t count, Random rng)
void handler(int, siginfo_t *, void *)
Gen range(Value begin, Value end)
bool test(const Value ¤t) const
FoldLeft foldl(Seed seed=Seed(), Fold fold=Fold())
Optional< StorageType > compose(const GenImpl< Value, Source > &source) const
ConcatImplActionP3< std::string, T1, T2 > Concat(const std::string &a, T1 b, T2 c)
std::unique_ptr< const WrapperBase > clone() const override
bool apply(Handler &&handler) const
Source && compose(GenImpl< Value, Source > &&source) const
size_t compose(const GenImpl< Value, Source > &source) const
const Value * get_pointer() const &
detail::Window window(size_t windowSize)
StorageType compose(const GenImpl< Value, Source > &source) const
constexpr detail::IsEmpty< true > isEmpty
invoke_result_t< Selector, ParamType > KeyType
Ret operator()(Source &&source) const
SingleReference(Value &ref)
bool apply(Handler &&handler) const
bool Value(const T &value, M matcher)
Gen compose(GenImpl< Value, Source > &&source) const
RangeWithStepImpl(Value end, Distance step)
Gen compose(const GenImpl< Value, Source > &source) const
Gen compose(const GenImpl< Value, Source > &source) const
Optional< StorageType > compose(const GenImpl< Value, Source > &source) const
auto end(TestAdlIterable &instance)
bool apply(Handler &&handler) const
bool apply(Handler &&handler) const
constexpr detail::RangeConcat rconcat
std::decay< Value >::type StorageType
Generator(Source source, size_t count)
void step(Value ¤t) const
constexpr detail::Indirect indirect
std::decay< KeyType >::type KeyStorageType
FOLLY_CPP14_CONSTEXPR bool hasValue() const noexcept
Gen compose(const GenImpl< Value, Source > &source) const
bool apply(Handler &&handler) const
Gen compose(GenImpl< Value, Source > &&source) const
Append(Collection *collection)
Generator(Source source, const Visitor &visitor)
Gen compose(const GenImpl< Value, Source > &source) const
Gen compose(const GenImpl< Value, Source > &source) const
Min(Selector selector, Comparer comparer)
constexpr detail::Cycle< true > cycle
void step(Value ¤t) const
bool apply(Handler &&handler) const
Window(size_t windowSize)
std::array< uint8_t, 32 > Random
GuardImpl(ErrorHandler handler)
static const char *const value
Gen compose(const GenImpl< Value, Source > &source) const
Gen compose(GenImpl< Value, Source > &&source) const
Value & emplace(Args &&...args)
Generator(Source source, const Predicate &pred)
Gen compose(GenImpl< Value, Source > &&source) const
Gen compose(GenImpl< Value, Source > &&source) const
VectorType operator|(const CollectTemplate< std::vector > &) const
Gen compose(const GenImpl< Value, Source > &source) const
Optional< NamedGroup > group
Generator(Source source, Selector selector)
VirtualGen(const VirtualGen &source)
constexpr detail::Concat concat
Gen compose(const GenImpl< Value, Source > &source) const
RangeSource(Range< Iterator > range)
void step(Value ¤t) const
Cycle< false > operator()(off_t limit) const
void step(Value ¤t) const
Generator(Source source, Selector selector, Comparer comparer)
Generator(Source source, size_t count)
FoldLeft(Seed seed, Fold fold)
FOLLY_ALWAYS_INLINE FOLLY_ATTR_VISIBILITY_HIDDEN auto fold(Fn &&, A &&a)
const Self & self() const
Gen compose(GenImpl< Value, Source > &&source) const
constexpr detail::Unwrap unwrap
Gen compose(GenImpl< Value, Source > &&source) const
bool apply(const std::function< bool(Value)> &handler) const override
CopiedSource(const SourceContainer &container)
detail::Take take(Number count)
bool apply(Handler &&handler) const
FOLLY_CPP14_CONSTEXPR const Value & value() const &
Collection compose(const GenImpl< Value, Source > &source) const
bool apply(Handler &&handler) const
Collection compose(const GenImpl< Value, Source > &source) const
Gen compose(const GenImpl< Value, Source > &source) const
Generator(Source source, size_t batchSize)
const Source & compose(const GenImpl< Value, Source > &source) const
Gen compose(const GenImpl< Value, Source > &source) const
bool apply(Handler &&handler) const
std::vector< StorageType > VectorType
Gen compose(GenImpl< Value, Source > &&source) const
Generator(Source source, size_t stride)
bool compose(const GenImpl< Value, Source > &source) const
Gen compose(const GenImpl< Value, Source > &source) const
Gen compose(GenImpl< Value, Source > &&source) const
bool apply(Handler &&handler) const
bool apply(Handler &&handler) const
Generator(Source source, size_t count, Random rng)
Gen compose(GenImpl< Value, Source > &&source) const
Generator(Source source, Selector selector)
decltype(auto) constexpr apply(F &&func, Tuple &&tuple)
bool apply(Handler &&handler) const
Gen compose(const GenImpl< Value, Source > &source) const
Distinct(Selector selector)
bool apply(Handler &&handler) const
bool apply(Handler &&handler) const
Group< KeyDecayed, ValueDecayed > GroupType
bool apply(Handler &&handler) const
bool apply(Handler &&handler) const
detail::Stride stride(size_t s)
Gen compose(const GenImpl< Value, Source > &source) const
bool apply(Handler &&handler) const
bool test(const Value &) const
bool apply(Handler &&handler) const
std::vector< int > values(1'000)
VirtualGen & operator=(VirtualGen &&source) noexcept
constexpr detail::First first
Gen compose(const GenImpl< Value, Source > &source) const
bool apply(const std::function< bool(Value)> &handler) const
constexpr detail::Dereference dereference
CopiedSource(Container &&container)