summaryrefslogtreecommitdiff
path: root/Rx/v2/src/rxcpp/operators/rx-group_by.hpp
diff options
context:
space:
mode:
authorKirk Shoop <kirk.shoop@microsoft.com>2016-03-09 19:10:03 -0800
committerKirk Shoop <kirk.shoop@microsoft.com>2016-03-10 17:24:21 -0800
commit33ccae2842a9558286f2d0a258806939ac748d75 (patch)
tree790dc15140fb3acd2ef8ee7dfe3a7c41a88161b6 /Rx/v2/src/rxcpp/operators/rx-group_by.hpp
parent18605f6fbca9bca6b3230029a928a0aa4fcd3de3 (diff)
downloadRxCpp-33ccae2842a9558286f2d0a258806939ac748d75.tar.gz
make operator| work better
converts linesfrombytes example to use operator|
Diffstat (limited to 'Rx/v2/src/rxcpp/operators/rx-group_by.hpp')
-rw-r--r--Rx/v2/src/rxcpp/operators/rx-group_by.hpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/Rx/v2/src/rxcpp/operators/rx-group_by.hpp b/Rx/v2/src/rxcpp/operators/rx-group_by.hpp
index 203f3c9..6da0af0 100644
--- a/Rx/v2/src/rxcpp/operators/rx-group_by.hpp
+++ b/Rx/v2/src/rxcpp/operators/rx-group_by.hpp
@@ -190,7 +190,7 @@ public:
template<class Observable>
struct group_by_factory_traits
{
- typedef rxu::value_type_t<Observable> value_type;
+ typedef rxu::value_type_t<rxu::decay_t<Observable>> value_type;
typedef detail::group_by_traits<value_type, Observable, KeySelector, MarbleSelector, BinaryPredicate> traits_type;
typedef detail::group_by<value_type, Observable, KeySelector, MarbleSelector, BinaryPredicate> group_by_type;
};
@@ -209,6 +209,18 @@ inline auto group_by(KeySelector ks, MarbleSelector ms, BinaryPredicate p)
return detail::group_by_factory<KeySelector, MarbleSelector, BinaryPredicate>(std::move(ks), std::move(ms), std::move(p));
}
+template<class KeySelector, class MarbleSelector>
+inline auto group_by(KeySelector ks, MarbleSelector ms)
+ -> detail::group_by_factory<KeySelector, MarbleSelector, rxu::less> {
+ return detail::group_by_factory<KeySelector, MarbleSelector, rxu::less>(std::move(ks), std::move(ms), rxu::less());
+}
+
+template<class KeySelector>
+inline auto group_by(KeySelector ks)
+ -> detail::group_by_factory<KeySelector, rxu::detail::take_at<0>, rxu::less> {
+ return detail::group_by_factory<KeySelector, rxu::detail::take_at<0>, rxu::less>(std::move(ks), rxu::take_at<0>(), rxu::less());
+}
+
}