Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -153,8 +155,7 @@

{
"name": "ci-build",
"binaryDir": "${sourceDir}/build",
"inherits" : ["ci-flags"]
"binaryDir": "${sourceDir}/build"
},
{
"name": "ci-coverage",
Expand Down
28 changes: 23 additions & 5 deletions HACKING.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,20 @@ the project:
"configurePresets": [
{
"name": "dev",
"binaryDir": "${sourceDir}/build/dev",
"binaryDir": "${sourceDir}/build",
"inherits": ["dev-mode", "ci-<os>"],
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
"CMAKE_BUILD_TYPE" : "Debug",
"RPP_BUILD_EXAMPLES" : "ON"
}
}
],
"buildPresets": [
{
"name": "dev",
"configurePreset": "dev",
"configuration": "Debug"
"configuration": "Debug",
"jobs" : 2
}
],
"testPresets": [
Expand All @@ -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
Expand Down Expand Up @@ -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
`<binary-dir>/coverage_html` by default.

<!--
#### `format-check` and `format-fix`

These targets run the clang-format tool on the codebase to check errors and to
Expand All @@ -121,7 +125,21 @@ fix them respectively. Customization available using the `FORMAT_PATTERNS` and

These targets run the codespell tool on the codebase to check errors and to fix
them respectively. Customization available using the `SPELL_COMMAND` cache
variable.
variable. -->


## 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<constraint::subscriber TSub>
void operator(auto&& value, const TSub& subscribier)
```

[1]: https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html
[2]: https://cmake.org/download/
5 changes: 3 additions & 2 deletions src/rpp/rpp/operators/filter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@ struct filter_impl
{
RPP_NO_UNIQUE_ADDRESS Predicate predicate;

void operator()(auto&& value, const constraint::subscriber_of_type<Type> auto& subscriber) const
template<typename TVal, constraint::subscriber_of_type<Type> TSub>
void operator()(TVal&& value, const TSub& subscriber) const
{
if (predicate(utils::as_const(value)))
subscriber.on_next(std::forward<decltype(value)>(value));
subscriber.on_next(std::forward<TVal>(value));
}
};

Expand Down
5 changes: 3 additions & 2 deletions src/rpp/rpp/operators/take_while.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@ struct take_while_impl
{
RPP_NO_UNIQUE_ADDRESS Predicate predicate;

void operator()(auto&& value, const constraint::subscriber_of_type<Type> auto& subscriber) const
template<typename TVal, constraint::subscriber_of_type<Type> TSub>
void operator()(TVal&& value, const TSub& subscriber) const
{
if (predicate(utils::as_const(value)))
subscriber.on_next(std::forward<decltype(value)>(value));
subscriber.on_next(std::forward<TVal>(value));
else
subscriber.on_completed();
}
Expand Down
10 changes: 6 additions & 4 deletions src/rpp/rpp/sources/from.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,16 @@ class iterate_impl
: m_iterable{std::move(iterable)}
, m_scheduler{scheduler} {}

void operator()(constraint::subscriber auto&& subscriber) const &
template<constraint::subscriber TSub>
void operator()(TSub&& subscriber) const &
{
details::iterate(m_iterable, m_scheduler, std::forward<decltype(subscriber)>(subscriber));
details::iterate(m_iterable, m_scheduler, std::forward<TSub>(subscriber));
}

void operator()(constraint::subscriber auto&& subscriber) const &&
template<constraint::subscriber TSub>
void operator()(TSub&& subscriber) const &&
{
details::iterate(std::move(m_iterable), m_scheduler, std::forward<decltype(subscriber)>(subscriber));
details::iterate(std::move(m_iterable), m_scheduler, std::forward<TSub>(subscriber));
}

private:
Expand Down