namespace gen {
class Less {
-public:
+ public:
template <class First, class Second>
auto operator()(const First& first, const Second& second) const ->
decltype(first < second) {
};
class Greater {
-public:
+ public:
template <class First, class Second>
auto operator()(const First& first, const Second& second) const ->
decltype(first > second) {
template <int n>
class Get {
-public:
+ public:
template <class Value>
auto operator()(Value&& value) const ->
decltype(std::get<n>(std::forward<Value>(value))) {
};
class Move {
-public:
+ public:
template <class Value>
auto operator()(Value&& value) const ->
decltype(std::move(std::forward<Value>(value))) {
class Skip;
+template <class Visitor>
+class Visit;
+
template <class Selector, class Comparer = Less>
class Order;
class Batch;
+class Window;
+
class Dereference;
class Indirect;
class Unwrap;
-}
+} // namespace detail
/**
* Polymorphic wrapper
*
* auto gen = GENERATOR(int) { yield(1); yield(2); };
*/
-#define GENERATOR(TYPE) \
- ::folly::gen::detail::GeneratorBuilder<TYPE>() + \
- [=](const std::function<void(TYPE)>& yield)
+#define GENERATOR(TYPE) \
+ ::folly::gen::detail::GeneratorBuilder<TYPE>() + [=](auto&& yield)
/*
* empty() - for producing empty sequences.
return Filter(std::move(pred));
}
+template <class Visitor = Ignore, class Visit = detail::Visit<Visitor>>
+Visit visit(Visitor visitor = Visitor()) {
+ return Visit(std::move(visitor));
+}
+
template <class Predicate, class Until = detail::Until<Predicate>>
Until until(Predicate pred = Predicate()) {
return Until(std::move(pred));
*
* from(source) | all(pred) == from(source) | filter(negate(pred)) | isEmpty
*/
-
template <
class Predicate = Identity,
class Filter = detail::Filter<Negate<Predicate>>,
UnwrapOr unwrapOr(Fallback&& fallback) {
return UnwrapOr(std::forward<Fallback>(fallback));
}
-} // gen
-} // folly
+
+} // namespace gen
+} // namespace folly
#include <folly/gen/Base-inl.h>