diff options
author | Kirk Shoop <kirk.shoop@microsoft.com> | 2016-09-27 00:25:08 -0700 |
---|---|---|
committer | Kirk Shoop <kirk.shoop@microsoft.com> | 2016-10-12 10:03:28 -0700 |
commit | 39fe8d073e3f58c3b5bea09aefb8315e6f86f817 (patch) | |
tree | 7a64f5354c07eaae40a1355f2fb6502ee53c33e5 /Rx/v2/examples | |
parent | 27018ea438a15a74404fbc0ca68178d5ef7eeaad (diff) | |
download | RxCpp-39fe8d073e3f58c3b5bea09aefb8315e6f86f817.tar.gz |
decouple zip operator from observable
made changes to the operator implementation pattern. using zip as the
first example.
allows rx-lite.hpp to not include the operators and instead have the
app explicitly include only the operators needed.
allows all zip related logic to be only in the rx-zip.hpp. observable
only has a forwarding function named zip and operators define zip_tag
and its include_header member.
improves docs by linking the observable and free operator methods to
the single doc at file scope.
operator_member_missing overloads allow static asserts to help usage.
the include_header member of the zip_tag allows a static assert to ask
for the zip file to be included when omitted in rx-lite mode
Diffstat (limited to 'Rx/v2/examples')
-rw-r--r-- | Rx/v2/examples/doxygen/main.cpp | 9 | ||||
-rw-r--r-- | Rx/v2/examples/doxygen/range.cpp | 7 | ||||
-rw-r--r-- | Rx/v2/examples/doxygen/zip.cpp | 2 |
3 files changed, 11 insertions, 7 deletions
diff --git a/Rx/v2/examples/doxygen/main.cpp b/Rx/v2/examples/doxygen/main.cpp index 0c7c351..8a831f2 100644 --- a/Rx/v2/examples/doxygen/main.cpp +++ b/Rx/v2/examples/doxygen/main.cpp @@ -1,2 +1,11 @@ #define CATCH_CONFIG_MAIN #include "catch.hpp" + +#include <iostream> +#include <thread> +#include <string> +std::string get_pid() { + std::stringstream s; + s << std::this_thread::get_id(); + return s.str(); +} diff --git a/Rx/v2/examples/doxygen/range.cpp b/Rx/v2/examples/doxygen/range.cpp index 7b84d7f..69eecbd 100644 --- a/Rx/v2/examples/doxygen/range.cpp +++ b/Rx/v2/examples/doxygen/range.cpp @@ -13,12 +13,7 @@ SCENARIO("range sample"){ printf("//! [range sample]\n"); } -#include <iostream> -std::string get_pid() { - std::stringstream s; - s << std::this_thread::get_id(); - return s.str(); -} +std::string get_pid(); SCENARIO("threaded range sample"){ printf("//! [threaded range sample]\n"); diff --git a/Rx/v2/examples/doxygen/zip.cpp b/Rx/v2/examples/doxygen/zip.cpp index 9085110..c5cd07b 100644 --- a/Rx/v2/examples/doxygen/zip.cpp +++ b/Rx/v2/examples/doxygen/zip.cpp @@ -51,7 +51,7 @@ SCENARIO("Selector zip sample"){ auto o1 = rxcpp::observable<>::interval(std::chrono::milliseconds(1)); auto o2 = rxcpp::observable<>::interval(std::chrono::milliseconds(2)); auto o3 = rxcpp::observable<>::interval(std::chrono::milliseconds(3)); - auto values = o1.zip( + auto values = o1 | rxcpp::operators::zip( [](int v1, int v2, int v3) { return 100 * v1 + 10 * v2 + v3; }, |