diff options
author | Valery Kopylov <v-valkop@microsoft.com> | 2015-06-04 19:15:54 +0300 |
---|---|---|
committer | Valery Kopylov <v-valkop@microsoft.com> | 2015-06-09 13:00:56 +0300 |
commit | 8390b5fb4a0ee0b963beeb7b3e1881a79d8b4bf3 (patch) | |
tree | adafe4dccaa0d103c4c80b280270458611f0c474 /Rx | |
parent | 03d36e3bb23be44a85021f5ae2f86225c423d2f6 (diff) | |
download | RxCpp-8390b5fb4a0ee0b963beeb7b3e1881a79d8b4bf3.tar.gz |
Simplify blocking count
Diffstat (limited to 'Rx')
-rw-r--r-- | Rx/v2/src/rxcpp/rx-observable.hpp | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index b9c8a1c..a77b083 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -337,14 +337,7 @@ public: \snippet output.txt blocking count error sample */ int count() const { - rxu::maybe<T> result; - rxu::maybe<std::exception_ptr> error; - source.count().as_blocking().subscribe( - [&](T v){result.reset(v);}, - [&](std::exception_ptr ep){error.reset(ep);}); - if (!error.empty()) - std::rethrow_exception(error.get()); - return result.get(); + return source.count().as_blocking().last(); } /*! Return the sum of all items emitted by this blocking_observable, or throw an std::runtime_error exception if it emits no items. |