diff --git a/CMakePresets.json b/CMakePresets.json index 13e1afa24..dcfccf8df 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -49,6 +49,7 @@ }, { "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 +58,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" @@ -153,8 +155,7 @@ { "name": "ci-build", - "binaryDir": "${sourceDir}/build", - "inherits" : ["ci-flags"] + "binaryDir": "${sourceDir}/build" }, { "name": "ci-coverage", diff --git a/HACKING.md b/HACKING.md index 319ee060a..33341d7c6 100644 --- a/HACKING.md +++ b/HACKING.md @@ -40,10 +40,11 @@ the project: "configurePresets": [ { "name": "dev", - "binaryDir": "${sourceDir}/build/dev", + "binaryDir": "${sourceDir}/build", "inherits": ["dev-mode", "ci-"], "cacheVariables": { - "CMAKE_BUILD_TYPE": "Debug" + "CMAKE_BUILD_TYPE" : "Debug", + "RPP_BUILD_EXAMPLES" : "ON" } } ], @@ -51,7 +52,8 @@ the project: { "name": "dev", "configurePreset": "dev", - "configuration": "Debug" + "configuration": "Debug", + "jobs" : 2 } ], "testPresets": [ @@ -75,6 +77,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 +114,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/ 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: