summaryrefslogtreecommitdiff
path: root/Rx/v2/src/rxcpp/rx-observable.hpp
diff options
context:
space:
mode:
authorRafaƂ Borowiak <ravirael@gmail.com>2016-12-09 16:33:08 +0100
committerKirk Shoop <kirk.shoop@microsoft.com>2016-12-09 07:33:08 -0800
commit0cf6cacc8114b9e503b674bdf21042892f73fb3a (patch)
treef9532ba6e3f2b2da2701331f3bd895f9e18bec1f /Rx/v2/src/rxcpp/rx-observable.hpp
parent3ba04a7f41a0e3b3136c29477e6ac68368b39a1a (diff)
downloadRxCpp-0cf6cacc8114b9e503b674bdf21042892f73fb3a.tar.gz
Issue #283: take_while operator implementation (#287)
* Implementation of take_while operator and tests * Refactored tests and changed documentation * Removed 'noexcept' specifier from helper class in take_while test * Removed 'const' specifier from not_equal_to helper class in take_while test in order to get rid of MSVC assignment operator warning.
Diffstat (limited to 'Rx/v2/src/rxcpp/rx-observable.hpp')
-rw-r--r--Rx/v2/src/rxcpp/rx-observable.hpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp
index 7d37f45..e3b1d13 100644
--- a/Rx/v2/src/rxcpp/rx-observable.hpp
+++ b/Rx/v2/src/rxcpp/rx-observable.hpp
@@ -2940,6 +2940,24 @@ public:
return take_until(rxs::timer(when, cn), cn);
}
+ /*! For the first items fulfilling the predicate from this observable emit them from the new observable that is returned.
+
+ \tparam Predicate the type of the predicate
+
+ \param t the predicate
+
+ \return An observable that emits only the first items emitted by the source Observable fulfilling the predicate, or all of the items from the source observable if the predicate never returns false
+*/
+ template<class Predicate>
+ auto take_while(Predicate t) const
+ /// \cond SHOW_SERVICE_MEMBERS
+ -> observable<T, rxo::detail::take_while<T, this_type, Predicate>>
+ /// \endcond
+ {
+ return observable<T, rxo::detail::take_while<T, this_type, Predicate>>(
+ rxo::detail::take_while<T, this_type, Predicate>(*this, t));
+ }
+
/*! Infinitely repeat this observable.
\return An observable that emits the items emitted by the source observable repeatedly and in sequence.