aboutsummaryrefslogtreecommitdiffstats
path: root/Rx/v2/examples
diff options
context:
space:
mode:
authorRafaƂ Borowiak <ravirael@gmail.com>2016-12-22 06:38:38 +0100
committerKirk Shoop <kirk.shoop@microsoft.com>2016-12-21 21:38:38 -0800
commitc11c2d727c25dce0bdc34fa7fd850b31dd66ccf8 (patch)
tree450c29110877717b808703df814bba91aaf03d55 /Rx/v2/examples
parentae41c69ff2684ad2d80841948e0bed203a0b7504 (diff)
downloadplatform_external_Reactive-Extensions_RxCpp-c11c2d727c25dce0bdc34fa7fd850b31dd66ccf8.tar.gz
platform_external_Reactive-Extensions_RxCpp-c11c2d727c25dce0bdc34fa7fd850b31dd66ccf8.tar.bz2
platform_external_Reactive-Extensions_RxCpp-c11c2d727c25dce0bdc34fa7fd850b31dd66ccf8.zip
take_while snippet (#299)
* 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. * decouple take_while from observable * Added take_while snippet. * Fixed CMakeLists closing parenthesis.
Diffstat (limited to 'Rx/v2/examples')
-rw-r--r--Rx/v2/examples/doxygen/take_while.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/Rx/v2/examples/doxygen/take_while.cpp b/Rx/v2/examples/doxygen/take_while.cpp
new file mode 100644
index 0000000..ea92826
--- /dev/null
+++ b/Rx/v2/examples/doxygen/take_while.cpp
@@ -0,0 +1,17 @@
+#include "rxcpp/rx.hpp"
+
+#include "rxcpp/rx-test.hpp"
+#include "catch.hpp"
+
+SCENARIO("take_while sample"){
+ printf("//! [take_while sample]\n");
+ auto values = rxcpp::observable<>::range(1, 8).
+ take_while([](int v){
+ return v <= 4;
+ });
+ values.
+ subscribe(
+ [](int v){printf("OnNext: %d\n", v);},
+ [](){printf("OnCompleted\n");});
+ printf("//! [take_while sample]\n");
+} \ No newline at end of file