From 4e8e5f1669a8af4c47e0c3b6e7f2b6ca6d0f9a0e Mon Sep 17 00:00:00 2001 From: Aleksey Loginov Date: Mon, 7 Nov 2022 23:32:38 +0300 Subject: [PATCH 1/4] Fix issues --- src/rpp/rpp/operators/filter.hpp | 5 +++-- src/rpp/rpp/operators/take_while.hpp | 5 +++-- src/rpp/rpp/sources/from.hpp | 10 ++++++---- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/rpp/rpp/operators/filter.hpp b/src/rpp/rpp/operators/filter.hpp index 5a2e69200..09355df28 100644 --- a/src/rpp/rpp/operators/filter.hpp +++ b/src/rpp/rpp/operators/filter.hpp @@ -27,10 +27,11 @@ struct filter_impl { RPP_NO_UNIQUE_ADDRESS Predicate predicate; - void operator()(auto&& value, const constraint::subscriber_of_type auto& subscriber) const + template TSub> + void operator()(TVal&& value, const TSub& subscriber) const { if (predicate(utils::as_const(value))) - subscriber.on_next(std::forward(value)); + subscriber.on_next(std::forward(value)); } }; diff --git a/src/rpp/rpp/operators/take_while.hpp b/src/rpp/rpp/operators/take_while.hpp index 0778c8a7f..815789f9e 100644 --- a/src/rpp/rpp/operators/take_while.hpp +++ b/src/rpp/rpp/operators/take_while.hpp @@ -26,10 +26,11 @@ struct take_while_impl { RPP_NO_UNIQUE_ADDRESS Predicate predicate; - void operator()(auto&& value, const constraint::subscriber_of_type auto& subscriber) const + template TSub> + void operator()(TVal&& value, const TSub& subscriber) const { if (predicate(utils::as_const(value))) - subscriber.on_next(std::forward(value)); + subscriber.on_next(std::forward(value)); else subscriber.on_completed(); } diff --git a/src/rpp/rpp/sources/from.hpp b/src/rpp/rpp/sources/from.hpp index 8e138bde7..4f0d3f295 100644 --- a/src/rpp/rpp/sources/from.hpp +++ b/src/rpp/rpp/sources/from.hpp @@ -118,14 +118,16 @@ class iterate_impl : m_iterable{std::move(iterable)} , m_scheduler{scheduler} {} - void operator()(constraint::subscriber auto&& subscriber) const & + template + void operator()(TSub&& subscriber) const & { - details::iterate(m_iterable, m_scheduler, std::forward(subscriber)); + details::iterate(m_iterable, m_scheduler, std::forward(subscriber)); } - void operator()(constraint::subscriber auto&& subscriber) const && + template + void operator()(TSub&& subscriber) const && { - details::iterate(std::move(m_iterable), m_scheduler, std::forward(subscriber)); + details::iterate(std::move(m_iterable), m_scheduler, std::forward(subscriber)); } private: From 3df34d215f79a65c6cac87aeb482588d50a0d92a Mon Sep 17 00:00:00 2001 From: Aleksey Loginov Date: Mon, 7 Nov 2022 23:32:43 +0300 Subject: [PATCH 2/4] Comments --- HACKING.md | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/HACKING.md b/HACKING.md index 319ee060a..95ddd441f 100644 --- a/HACKING.md +++ b/HACKING.md @@ -40,10 +40,10 @@ the project: "configurePresets": [ { "name": "dev", - "binaryDir": "${sourceDir}/build/dev", "inherits": ["dev-mode", "ci-"], "cacheVariables": { - "CMAKE_BUILD_TYPE": "Debug" + "CMAKE_BUILD_TYPE" : "Debug", + "RPP_BUILD_EXAMPLES" : "ON" } } ], @@ -51,7 +51,8 @@ the project: { "name": "dev", "configurePreset": "dev", - "configuration": "Debug" + "configuration": "Debug", + "jobs" : 2 } ], "testPresets": [ @@ -75,6 +76,8 @@ these correspond to in the [`CMakePresets.json`](CMakePresets.json) file. sorts of things that you would otherwise want to pass to the configure command in the terminal. +Don't forget to add some compile options to enable different parts of RPP like enabling tests/benchmarks + ### Configure, build and test If you followed the above instructions, then you can configure, build and test @@ -110,7 +113,7 @@ this target runs can be found in the `COVERAGE_TRACE_COMMAND` and file by default, which can be submitted to services with CI integration. The HTML command uses the trace command's output to generate a HTML document to `/coverage_html` by default. - + + + +## Tricky moments + +### Inline constraints/conepts +When you are developing new operators be sure, that your lift-operator doesn't use inline constraints over subscribers like this: +```cpp +void operator(auto&& value, const constraint::subscriber auto& subscribier) +``` +In this case intellisense of VS Code can't deduce final type of observable. Prefer this one: +```cpp +template +void operator(auto&& value, const TSub& subscribier) +``` [1]: https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html [2]: https://cmake.org/download/ From acbaf58a4088b0f98713053a90e7dca845ca79f3 Mon Sep 17 00:00:00 2001 From: Aleksey Loginov Date: Mon, 7 Nov 2022 23:32:50 +0300 Subject: [PATCH 3/4] Minor presets changes --- CMakePresets.json | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/CMakePresets.json b/CMakePresets.json index 13e1afa24..34aa7f445 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -43,12 +43,14 @@ "name": "ci-flags", "hidden" : true, "inherits" : ["dev-mode", "std"], + "binaryDir": "${sourceDir}/build", "cacheVariables": { "CMAKE_EXPORT_COMPILE_COMMANDS" : "ON" } }, { "name": "flags-unix", + "inherits" : ["ci-flags"], "hidden": true, "cacheVariables": { "CMAKE_CXX_FLAGS": "-Wall -Werror -Wextra -Wpedantic -Wcast-qual -Wformat=2 -Wundef -Werror=float-equal" @@ -57,6 +59,7 @@ { "name": "flags-windows", "description": "Note that all the flags after /W4 are required for MSVC to conform to the language standard", + "inherits" : ["ci-flags"], "hidden": true, "cacheVariables": { "CMAKE_CXX_FLAGS": "/utf-8 /W4 /permissive- /volatile:iso /Zc:preprocessor /EHsc /Zc:__cplusplus /Zc:externConstexpr /Zc:throwingNew" @@ -152,9 +155,7 @@ { - "name": "ci-build", - "binaryDir": "${sourceDir}/build", - "inherits" : ["ci-flags"] + "name": "ci-build" }, { "name": "ci-coverage", From 5d2771dbb9c5f40aca24337d6df7d080c0701218 Mon Sep 17 00:00:00 2001 From: Aleksey Loginov Date: Mon, 7 Nov 2022 23:41:48 +0300 Subject: [PATCH 4/4] presets --- CMakePresets.json | 4 ++-- HACKING.md | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CMakePresets.json b/CMakePresets.json index 34aa7f445..dcfccf8df 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -43,7 +43,6 @@ "name": "ci-flags", "hidden" : true, "inherits" : ["dev-mode", "std"], - "binaryDir": "${sourceDir}/build", "cacheVariables": { "CMAKE_EXPORT_COMPILE_COMMANDS" : "ON" } @@ -155,7 +154,8 @@ { - "name": "ci-build" + "name": "ci-build", + "binaryDir": "${sourceDir}/build" }, { "name": "ci-coverage", diff --git a/HACKING.md b/HACKING.md index 95ddd441f..33341d7c6 100644 --- a/HACKING.md +++ b/HACKING.md @@ -40,6 +40,7 @@ the project: "configurePresets": [ { "name": "dev", + "binaryDir": "${sourceDir}/build", "inherits": ["dev-mode", "ci-"], "cacheVariables": { "CMAKE_BUILD_TYPE" : "Debug",