From: Yedidya Feldblum Date: Fri, 9 Jun 2017 05:34:09 +0000 (-0700) Subject: Apply clang-format to folly/gen/ (template decls) X-Git-Tag: v2017.06.12.00~7 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=adb8559d5aae490f6a5620d5148f61322a267242;p=folly.git Apply clang-format to folly/gen/ (template decls) Summary: [Folly] Apply `clang-format` to `folly/gen/` (template decls). Reviewed By: Orvid Differential Revision: D5216229 fbshipit-source-id: 1659f1944ccde4de39bccd189bb6490395cf29c2 --- diff --git a/folly/gen/Base-inl.h b/folly/gen/Base-inl.h index 716f5ace..c654cbcd 100644 --- a/folly/gen/Base-inl.h +++ b/folly/gen/Base-inl.h @@ -360,8 +360,7 @@ class InfiniteImpl { **/ template struct GeneratorBuilder { - template > + template > Yield operator+(Source&& source) { return Yield(std::forward(source)); } @@ -482,10 +481,11 @@ class Map : public Operator> { explicit Map(Predicate pred) : pred_(std::move(pred)) {} - template ::type>::type> + template < + class Value, + class Source, + class Result = typename ArgumentReference< + typename std::result_of::type>::type> class Generator : public GenImpl> { Source source_; Predicate pred_; @@ -510,16 +510,12 @@ class Map : public Operator> { static constexpr bool infinite = Source::infinite; }; - template > + template > Gen compose(GenImpl&& source) const { return Gen(std::move(source.self()), pred_); } - template > + template > Gen compose(const GenImpl& source) const { return Gen(source.self(), pred_); } @@ -583,16 +579,12 @@ class Filter : public Operator> { static constexpr bool infinite = Source::infinite; }; - template > + template > Gen compose(GenImpl&& source) const { return Gen(std::move(source.self()), pred_); } - template > + template > Gen compose(const GenImpl& source) const { return Gen(source.self(), pred_); } @@ -644,16 +636,12 @@ class Until : public Operator> { static constexpr bool infinite = false; }; - template > + template > Gen compose(GenImpl&& source) const { return Gen(std::move(source.self()), pred_); } - template > + template > Gen compose(const GenImpl& source) const { return Gen(source.self(), pred_); } @@ -704,16 +692,12 @@ class Take : public Operator { static constexpr bool infinite = false; }; - template > + template > Gen compose(GenImpl&& source) const { return Gen(std::move(source.self()), count_); } - template > + template > Gen compose(const GenImpl& source) const { return Gen(source.self(), count_); } @@ -775,16 +759,12 @@ class Stride : public Operator { static constexpr bool infinite = Source::infinite; }; - template > + template > Gen compose(GenImpl&& source) const { return Gen(std::move(source.self()), stride_); } - template > + template > Gen compose(const GenImpl& source) const { return Gen(source.self(), stride_); } @@ -803,10 +783,11 @@ class Sample : public Operator> { explicit Sample(size_t count, Random rng) : count_(count), rng_(std::move(rng)) {} - template ::type> + template < + class Value, + class Source, + class Rand, + class StorageType = typename std::decay::type> class Generator : public GenImpl> { @@ -860,16 +841,18 @@ class Sample : public Operator> { static constexpr bool infinite = false; }; - template > + template < + class Source, + class Value, + class Gen = Generator> Gen compose(GenImpl&& source) const { return Gen(std::move(source.self()), count_, rng_); } - template > + template < + class Source, + class Value, + class Gen = Generator> Gen compose(const GenImpl& source) const { return Gen(source.self(), count_, rng_); } @@ -934,16 +917,12 @@ class Skip : public Operator { static constexpr bool infinite = Source::infinite; }; - template > + template > Gen compose(GenImpl&& source) const { return Gen(std::move(source.self()), count_); } - template > + template > Gen compose(const GenImpl& source) const { return Gen(source.self(), count_); } @@ -975,10 +954,11 @@ class Order : public Operator> { Order(Selector selector, Comparer comparer) : selector_(std::move(selector)), comparer_(std::move(comparer)) {} - template ::type, - class Result = typename std::result_of::type> + template < + class Value, + class Source, + class StorageType = typename std::decay::type, + class Result = typename std::result_of::type> class Generator : public GenImpl> { @@ -1041,16 +1021,12 @@ class Order : public Operator> { static constexpr bool infinite = false; }; - template > + template > Gen compose(GenImpl&& source) const { return Gen(std::move(source.self()), selector_, comparer_); } - template > + template > Gen compose(const GenImpl& source) const { return Gen(source.self(), selector_, comparer_); } @@ -1080,11 +1056,12 @@ class GroupBy : public Operator> { explicit GroupBy(Selector selector) : selector_(std::move(selector)) {} - template ::type, - class Key = typename std::result_of::type, - class KeyDecayed = typename std::decay::type> + template < + class Value, + class Source, + class ValueDecayed = typename std::decay::type, + class Key = typename std::result_of::type, + class KeyDecayed = typename std::decay::type> class Generator : public GenImpl< Group&&, @@ -1121,16 +1098,12 @@ class GroupBy : public Operator> { static constexpr bool infinite = false; }; - template > + template > Gen compose(GenImpl&& source) const { return Gen(std::move(source.self()), selector_); } - template > + template > Gen compose(const GenImpl& source) const { return Gen(source.self(), selector_); } @@ -1228,16 +1201,12 @@ class Distinct : public Operator> { static constexpr bool infinite = Source::infinite; }; - template > + template > Gen compose(GenImpl&& source) const { return Gen(std::move(source.self()), selector_); } - template > + template > Gen compose(const GenImpl& source) const { return Gen(source.self(), selector_); } @@ -1254,9 +1223,10 @@ class Composer { public: explicit Composer(Operators op) : op_(std::move(op)) {} - template ().compose(std::declval()))> + template < + class Source, + class Ret = + decltype(std::declval().compose(std::declval()))> Ret operator()(Source&& source) const { return op_.compose(std::forward(source)); } @@ -1285,10 +1255,11 @@ class Batch : public Operator { } } - template ::type, - class VectorType = std::vector> + template < + class Value, + class Source, + class StorageType = typename std::decay::type, + class VectorType = std::vector> class Generator : public GenImpl> { @@ -1325,16 +1296,12 @@ class Batch : public Operator { static constexpr bool infinite = Source::infinite; }; - template > + template > Gen compose(GenImpl&& source) const { return Gen(std::move(source.self()), batchSize_); } - template > + template > Gen compose(const GenImpl& source) const { return Gen(source.self(), batchSize_); } @@ -1360,9 +1327,10 @@ class Concat : public Operator { public: Concat() = default; - template ::type::ValueType> + template < + class Inner, + class Source, + class InnerValue = typename std::decay::type::ValueType> class Generator : public GenImpl> { Source source_; @@ -1393,16 +1361,12 @@ class Concat : public Operator { Source::infinite || std::decay::type::infinite; }; - template > + template > Gen compose(GenImpl&& source) const { return Gen(std::move(source.self())); } - template > + template > Gen compose(const GenImpl& source) const { return Gen(source.self()); } @@ -1424,9 +1388,10 @@ class RangeConcat : public Operator { public: RangeConcat() = default; - template ::RefType> + template < + class Range, + class Source, + class InnerValue = typename ValueTypeOfRange::RefType> class Generator : public GenImpl> { Source source_; @@ -1460,16 +1425,12 @@ class RangeConcat : public Operator { static constexpr bool infinite = Source::infinite; }; - template > + template > Gen compose(GenImpl&& source) const { return Gen(std::move(source.self())); } - template > + template > Gen compose(const GenImpl& source) const { return Gen(source.self()); } @@ -1530,16 +1491,12 @@ class GuardImpl : public Operator> { static constexpr bool infinite = Source::infinite; }; - template > + template > Gen compose(GenImpl&& source) const { return Gen(std::move(source.self()), handler_); } - template > + template > Gen compose(const GenImpl& source) const { return Gen(source.self(), handler_); } @@ -1557,9 +1514,10 @@ class Dereference : public Operator { public: Dereference() = default; - template ())> + template < + class Value, + class Source, + class Result = decltype(*std::declval())> class Generator : public GenImpl> { Source source_; @@ -1589,16 +1547,12 @@ class Dereference : public Operator { static constexpr bool infinite = Source::infinite; }; - template > + template > Gen compose(GenImpl&& source) const { return Gen(std::move(source.self())); } - template > + template > Gen compose(const GenImpl& source) const { return Gen(source.self()); } @@ -1616,9 +1570,10 @@ class Indirect : public Operator { public: Indirect() = default; - template ::type*> + template < + class Value, + class Source, + class Result = typename std::remove_reference::type*> class Generator : public GenImpl> { Source source_; static_assert(!std::is_rvalue_reference::value, @@ -1645,16 +1600,12 @@ class Indirect : public Operator { static constexpr bool infinite = Source::infinite; }; - template > + template > Gen compose(GenImpl&& source) const { return Gen(std::move(source.self())); } - template > + template > Gen compose(const GenImpl& source) const { return Gen(source.self()); } @@ -1722,16 +1673,12 @@ class Cycle : public Operator> { static constexpr bool infinite = forever || Source::infinite; }; - template > + template > Gen compose(GenImpl&& source) const { return Gen(std::move(source.self()), limit_); } - template > + template > Gen compose(const GenImpl& source) const { return Gen(source.self(), limit_); } @@ -1792,9 +1739,10 @@ class First : public Operator { public: First() = default; - template ::type> + template < + class Source, + class Value, + class StorageType = typename std::decay::type> Optional compose(const GenImpl& source) const { Optional accum; source | [&](Value v) -> bool { @@ -1862,9 +1810,10 @@ class Reduce : public Operator> { Reduce() = default; explicit Reduce(Reducer reducer) : reducer_(std::move(reducer)) {} - template ::type> + template < + class Source, + class Value, + class StorageType = typename std::decay::type> Optional compose(const GenImpl& source) const { static_assert(!Source::infinite, "Cannot reduce infinite source"); Optional accum; @@ -1910,9 +1859,10 @@ class Sum : public Operator { public: Sum() = default; - template ::type> + template < + class Source, + class Value, + class StorageType = typename std::decay::type> StorageType compose(const GenImpl& source) const { static_assert(!Source::infinite, "Cannot sum infinite source"); return foldl(StorageType(0), @@ -1937,9 +1887,10 @@ class Contains : public Operator> { public: explicit Contains(Needle needle) : needle_(std::move(needle)) {} - template ::type> + template < + class Source, + class Value, + class StorageType = typename std::decay::type> bool compose(const GenImpl& source) const { static_assert(!Source::infinite, "Calling contains on an infinite source might cause " @@ -1980,11 +1931,12 @@ class Min : public Operator> { Min(Selector selector, Comparer comparer) : selector_(std::move(selector)), comparer_(std::move(comparer)) {} - template ::type, - class Key = typename std::decay< - typename std::result_of::type>::type> + template < + class Value, + class Source, + class StorageType = typename std::decay::type, + class Key = typename std::decay< + typename std::result_of::type>::type> Optional compose(const GenImpl& source) const { static_assert(!Source::infinite, "Calling min or max on an infinite source will cause " @@ -2047,9 +1999,10 @@ class Collect : public Operator> { public: Collect() = default; - template ::type> + template < + class Value, + class Source, + class StorageType = typename std::decay::type> Collection compose(const GenImpl& source) const { static_assert(!Source::infinite, "Cannot convert infinite source to object with as."); @@ -2076,16 +2029,18 @@ class Collect : public Operator> { * * set uniqueNames = from(names) | as(); */ -template