return Until(std::move(pred));
}
-template<class Selector,
+template<class Selector = Identity,
class Comparer = Less,
class Order = detail::Order<Selector, Comparer>>
-Order orderBy(Selector selector = Identity(),
+Order orderBy(Selector selector = Selector(),
Comparer comparer = Comparer()) {
return Order(std::move(selector),
std::move(comparer));
}
-template<class Selector,
+template<class Selector = Identity,
class Order = detail::Order<Selector, Greater>>
-Order orderByDescending(Selector selector = Identity()) {
+Order orderByDescending(Selector selector = Selector()) {
return Order(std::move(selector));
}
-template<class Selector,
+template<class Selector = Identity,
class Distinct = detail::Distinct<Selector>>
-Distinct distinctBy(Selector selector = Identity()) {
+Distinct distinctBy(Selector selector = Selector()) {
return Distinct(std::move(selector));
}
| orderBy([](int x) { return (5.1 - x) * (5.1 - x); })
| as<vector>();
EXPECT_EQ(expected, actual);
+
+ expected = seq(1, 10) | as<vector>();
+ actual =
+ from(expected)
+ | map([] (int x) { return 11 - x; })
+ | orderBy()
+ | as<vector>();
+ EXPECT_EQ(expected, actual);
}
TEST(Gen, Foldl) {