From 7212d46ae4c213b186bbc1079ee77cec85711d9c Mon Sep 17 00:00:00 2001 From: Aleksey Loginov Date: Mon, 27 May 2024 22:29:20 +0300 Subject: [PATCH 01/11] Remove unused thing --- cmake/dependencies.cmake | 1 - 1 file changed, 1 deletion(-) diff --git a/cmake/dependencies.cmake b/cmake/dependencies.cmake index cd7a23f8c..c7269919b 100644 --- a/cmake/dependencies.cmake +++ b/cmake/dependencies.cmake @@ -74,7 +74,6 @@ endif() # ===================== Tests =================== if (RPP_BUILD_TESTS) rpp_fetch_library(Catch2 https://github.com/catchorg/Catch2.git v3.6.0) - target_compile_features(Catch2::Catch2WithMain INTERFACE cxx_std_20) rpp_fetch_library(trompeloeil https://github.com/rollbear/trompeloeil.git main) endif() From e8e7dd6ef2c2dccf030858e6145e5dec527cde63 Mon Sep 17 00:00:00 2001 From: Aleksey Loginov Date: Mon, 27 May 2024 23:03:37 +0300 Subject: [PATCH 02/11] add switch_on_next doc --- src/examples/rpp/doxygen/switch_on_next.cpp | 19 ++++++++++++++++ src/rpp/rpp/operators/switch_on_next.hpp | 24 +++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 src/examples/rpp/doxygen/switch_on_next.cpp diff --git a/src/examples/rpp/doxygen/switch_on_next.cpp b/src/examples/rpp/doxygen/switch_on_next.cpp new file mode 100644 index 000000000..48ca8bf30 --- /dev/null +++ b/src/examples/rpp/doxygen/switch_on_next.cpp @@ -0,0 +1,19 @@ +#include +#include + +/** + * \example switch_on_next.cpp + **/ +int main() +{ + //! [switch_on_next] + rpp::source::just(rpp::source::just(1).as_dynamic(), + rpp::source::never().as_dynamic(), + rpp::source::just(2).as_dynamic()) + | rpp::operators::switch_on_next() + | rpp::operators::subscribe([](int v) { std::cout << v << " "; }); + // Output: 1 2 + //! [switch_on_next] + + return 0; +} \ No newline at end of file diff --git a/src/rpp/rpp/operators/switch_on_next.hpp b/src/rpp/rpp/operators/switch_on_next.hpp index 9cd494e83..3cf559cee 100644 --- a/src/rpp/rpp/operators/switch_on_next.hpp +++ b/src/rpp/rpp/operators/switch_on_next.hpp @@ -157,6 +157,30 @@ namespace rpp::operators::details namespace rpp::operators { + /** + * @brief Converts observable of observables into observable of values which emits values from most recent underlying observable till new observable obtained + * + * @marble switch_on_next + { + source observable: + { + +--1-2-3-5--| + .....+4--6-9| + .......+7-8-| + } + operator "switch_on_next" : +--1-24-7-8| + } + * + * @details Actually this operator just unsubscribes from previous observable and subscribes on new observable when obtained in `on_next` + * + * @warning #include + * + * @par Example: + * @snippet switch_on_next.cpp switch_on_next + * + * @ingroup combining_operators + * @see https://reactivex.io/documentation/operators/switch.html + */ inline auto switch_on_next() { return details::switch_on_next_t{}; From 26e4abc4afda732db38e6e8853c54b23d56f276d Mon Sep 17 00:00:00 2001 From: Aleksey Loginov Date: Mon, 27 May 2024 23:34:41 +0300 Subject: [PATCH 03/11] apply variant_observable --- src/rpp/rpp/observables.hpp | 3 +- src/rpp/rpp/observables/fwd.hpp | 27 ++++++--- .../rpp/observables/variant_observable.hpp | 57 +++++++++++++++++++ src/rpp/rpp/sources/concat.hpp | 7 ++- src/rpp/rpp/utils/utils.hpp | 17 ++++++ 5 files changed, 99 insertions(+), 12 deletions(-) create mode 100644 src/rpp/rpp/observables/variant_observable.hpp diff --git a/src/rpp/rpp/observables.hpp b/src/rpp/rpp/observables.hpp index 279cb5d45..fdb438295 100644 --- a/src/rpp/rpp/observables.hpp +++ b/src/rpp/rpp/observables.hpp @@ -20,8 +20,9 @@ #include +#include #include #include #include #include -#include +#include diff --git a/src/rpp/rpp/observables/fwd.hpp b/src/rpp/rpp/observables/fwd.hpp index 7411fdca4..e57cc4a2e 100644 --- a/src/rpp/rpp/observables/fwd.hpp +++ b/src/rpp/rpp/observables/fwd.hpp @@ -50,16 +50,8 @@ namespace rpp template Strategy> class observable; +} - template - class dynamic_observable; - - template Strategy> - class blocking_observable; - - template Strategy> - class grouped_observable; -} // namespace rpp namespace rpp::constraint { @@ -124,6 +116,23 @@ namespace rpp::constraint concept observables_of_same_type = rpp::constraint::observable && (rpp::constraint::observable && ...) && (std::same_as, rpp::utils::extract_observable_type_t> && ...); } // namespace rpp::constraint +namespace rpp +{ + template + class dynamic_observable; + + template Strategy> + class blocking_observable; + + template Strategy> + class grouped_observable; + + template... Observables> + class variant_observable; +} // namespace rpp + + + #define RPP_CHECK_IF_TRAIT_ASSERTS_SATISFIED(Op, Type) \ /* operator_traits can be instantiated if all inner static_asserts are fine*/ \ if constexpr (requires { { typename std::decay_t::template operator_traits{}}; }) diff --git a/src/rpp/rpp/observables/variant_observable.hpp b/src/rpp/rpp/observables/variant_observable.hpp new file mode 100644 index 000000000..f5aad60e0 --- /dev/null +++ b/src/rpp/rpp/observables/variant_observable.hpp @@ -0,0 +1,57 @@ +// ReactivePlusPlus library +// +// Copyright Aleksey Loginov 2023 - present. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) +// +// Project home: https://github.com/victimsnino/ReactivePlusPlus + +#pragma once + +#include +#include + +#include + +namespace rpp::details +{ + template... Observables> + struct variant_observable_strategy + { + using value_type = Type; + + utils::unique_variant observables; + + template TObs> + void subscribe(TObs&& obs) const + { + std::visit([&](const auto& o) { o.subscribe(std::forward(obs)); }, observables); + } + }; +} // namespace rpp + +namespace rpp +{ + /** + * @brief Extension over rpp::observable to provide ability statically keep one of multiple observables + * + * @ingroup observables + */ + template... Observables> + class variant_observable : public rpp::observable> + { + using base = rpp::observable>; + public: + variant_observable(std::variant variant) : base{std::move(variant)} {} + + template + requires (constraint::decayed_any_of) + variant_observable(T&& o) : base{std::forward(o)} {} + + using base::base; + }; + + template>... Observables> + variant_observable(std::variant variant) -> variant_observable, T, Observables...>; +} diff --git a/src/rpp/rpp/sources/concat.hpp b/src/rpp/rpp/sources/concat.hpp index 4a5e37a49..44d2655d7 100644 --- a/src/rpp/rpp/sources/concat.hpp +++ b/src/rpp/rpp/sources/concat.hpp @@ -12,7 +12,7 @@ #include #include -#include +#include #include #include #include @@ -183,7 +183,10 @@ namespace rpp::source return rpp::details::make_concat_from_iterable(std::forward(obs), std::forward(others)...); } else - return concat(std::forward(obs).as_dynamic(), std::forward(others).as_dynamic()...); + { + using variant_observable_t = rpp::variant_observable, std::decay_t, std::decay_t...>; + return concat(variant_observable_t{std::forward(obs)}, variant_observable_t{std::forward(others)}...); + } } /** diff --git a/src/rpp/rpp/utils/utils.hpp b/src/rpp/rpp/utils/utils.hpp index 091af0d75..8cbeb6526 100644 --- a/src/rpp/rpp/utils/utils.hpp +++ b/src/rpp/rpp/utils/utils.hpp @@ -16,6 +16,7 @@ #include #include +#include namespace rpp::utils { @@ -312,6 +313,22 @@ namespace rpp::utils template using pointer_under_lock = typename value_with_mutex::pointer_under_lock; + namespace details + { + template + struct unique_variant_t : std::type_identity {}; + + template + requires (std::is_same_v || ...) + struct unique_variant_t, U, Us...> : unique_variant_t, Us...>{}; + + template + struct unique_variant_t, U, Us...> : public unique_variant_t, Us...> {}; + } + + template + using unique_variant = typename details::unique_variant_t, Ts...>::type; // inspired by https://stackoverflow.com/a/57528226/17771792 + #define RPP_CALL_DURING_CONSTRUCTION(...) RPP_NO_UNIQUE_ADDRESS rpp::utils::none _ = [&]() { \ __VA_ARGS__; \ From da37fb64d885111e0f3810216eb7b3a188646388 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 27 May 2024 20:34:45 +0000 Subject: [PATCH 04/11] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/examples/rpp/doxygen/switch_on_next.cpp | 7 +-- src/rpp/rpp/observables.hpp | 2 +- src/rpp/rpp/observables/fwd.hpp | 3 +- .../rpp/observables/variant_observable.hpp | 17 +++++-- src/rpp/rpp/operators/switch_on_next.hpp | 48 +++++++++---------- src/rpp/rpp/sources/concat.hpp | 2 +- src/rpp/rpp/utils/utils.hpp | 22 +++++---- 7 files changed, 57 insertions(+), 44 deletions(-) diff --git a/src/examples/rpp/doxygen/switch_on_next.cpp b/src/examples/rpp/doxygen/switch_on_next.cpp index 48ca8bf30..346310426 100644 --- a/src/examples/rpp/doxygen/switch_on_next.cpp +++ b/src/examples/rpp/doxygen/switch_on_next.cpp @@ -1,4 +1,5 @@ #include + #include /** @@ -10,10 +11,10 @@ int main() rpp::source::just(rpp::source::just(1).as_dynamic(), rpp::source::never().as_dynamic(), rpp::source::just(2).as_dynamic()) - | rpp::operators::switch_on_next() - | rpp::operators::subscribe([](int v) { std::cout << v << " "; }); + | rpp::operators::switch_on_next() + | rpp::operators::subscribe([](int v) { std::cout << v << " "; }); // Output: 1 2 //! [switch_on_next] return 0; -} \ No newline at end of file +} diff --git a/src/rpp/rpp/observables.hpp b/src/rpp/rpp/observables.hpp index fdb438295..1bf79618d 100644 --- a/src/rpp/rpp/observables.hpp +++ b/src/rpp/rpp/observables.hpp @@ -20,9 +20,9 @@ #include -#include #include #include #include #include +#include #include diff --git a/src/rpp/rpp/observables/fwd.hpp b/src/rpp/rpp/observables/fwd.hpp index e57cc4a2e..48a60147e 100644 --- a/src/rpp/rpp/observables/fwd.hpp +++ b/src/rpp/rpp/observables/fwd.hpp @@ -50,7 +50,7 @@ namespace rpp template Strategy> class observable; -} +} // namespace rpp namespace rpp::constraint @@ -132,7 +132,6 @@ namespace rpp } // namespace rpp - #define RPP_CHECK_IF_TRAIT_ASSERTS_SATISFIED(Op, Type) \ /* operator_traits can be instantiated if all inner static_asserts are fine*/ \ if constexpr (requires { { typename std::decay_t::template operator_traits{}}; }) diff --git a/src/rpp/rpp/observables/variant_observable.hpp b/src/rpp/rpp/observables/variant_observable.hpp index f5aad60e0..37836935a 100644 --- a/src/rpp/rpp/observables/variant_observable.hpp +++ b/src/rpp/rpp/observables/variant_observable.hpp @@ -19,7 +19,7 @@ namespace rpp::details template... Observables> struct variant_observable_strategy { - using value_type = Type; + using value_type = Type; utils::unique_variant observables; @@ -29,7 +29,7 @@ namespace rpp::details std::visit([&](const auto& o) { o.subscribe(std::forward(obs)); }, observables); } }; -} // namespace rpp +} // namespace rpp::details namespace rpp { @@ -42,16 +42,23 @@ namespace rpp class variant_observable : public rpp::observable> { using base = rpp::observable>; + public: - variant_observable(std::variant variant) : base{std::move(variant)} {} + variant_observable(std::variant variant) + : base{std::move(variant)} + { + } template requires (constraint::decayed_any_of) - variant_observable(T&& o) : base{std::forward(o)} {} + variant_observable(T&& o) + : base{std::forward(o)} + { + } using base::base; }; template>... Observables> variant_observable(std::variant variant) -> variant_observable, T, Observables...>; -} +} // namespace rpp diff --git a/src/rpp/rpp/operators/switch_on_next.hpp b/src/rpp/rpp/operators/switch_on_next.hpp index 3cf559cee..b4e7649fe 100644 --- a/src/rpp/rpp/operators/switch_on_next.hpp +++ b/src/rpp/rpp/operators/switch_on_next.hpp @@ -157,30 +157,30 @@ namespace rpp::operators::details namespace rpp::operators { - /** - * @brief Converts observable of observables into observable of values which emits values from most recent underlying observable till new observable obtained - * - * @marble switch_on_next - { - source observable: - { - +--1-2-3-5--| - .....+4--6-9| - .......+7-8-| - } - operator "switch_on_next" : +--1-24-7-8| - } - * - * @details Actually this operator just unsubscribes from previous observable and subscribes on new observable when obtained in `on_next` - * - * @warning #include - * - * @par Example: - * @snippet switch_on_next.cpp switch_on_next - * - * @ingroup combining_operators - * @see https://reactivex.io/documentation/operators/switch.html - */ + /** + * @brief Converts observable of observables into observable of values which emits values from most recent underlying observable till new observable obtained + * + * @marble switch_on_next + { + source observable: + { + +--1-2-3-5--| + .....+4--6-9| + .......+7-8-| + } + operator "switch_on_next" : +--1-24-7-8| + } + * + * @details Actually this operator just unsubscribes from previous observable and subscribes on new observable when obtained in `on_next` + * + * @warning #include + * + * @par Example: + * @snippet switch_on_next.cpp switch_on_next + * + * @ingroup combining_operators + * @see https://reactivex.io/documentation/operators/switch.html + */ inline auto switch_on_next() { return details::switch_on_next_t{}; diff --git a/src/rpp/rpp/sources/concat.hpp b/src/rpp/rpp/sources/concat.hpp index 44d2655d7..8ee5f537e 100644 --- a/src/rpp/rpp/sources/concat.hpp +++ b/src/rpp/rpp/sources/concat.hpp @@ -12,8 +12,8 @@ #include #include -#include #include +#include #include #include diff --git a/src/rpp/rpp/utils/utils.hpp b/src/rpp/rpp/utils/utils.hpp index 8cbeb6526..0fef33617 100644 --- a/src/rpp/rpp/utils/utils.hpp +++ b/src/rpp/rpp/utils/utils.hpp @@ -315,18 +315,24 @@ namespace rpp::utils namespace details { - template - struct unique_variant_t : std::type_identity {}; + template + struct unique_variant_t : std::type_identity + { + }; - template + template requires (std::is_same_v || ...) - struct unique_variant_t, U, Us...> : unique_variant_t, Us...>{}; + struct unique_variant_t, U, Us...> : unique_variant_t, Us...> + { + }; - template - struct unique_variant_t, U, Us...> : public unique_variant_t, Us...> {}; - } + template + struct unique_variant_t, U, Us...> : public unique_variant_t, Us...> + { + }; + } // namespace details - template + template using unique_variant = typename details::unique_variant_t, Ts...>::type; // inspired by https://stackoverflow.com/a/57528226/17771792 From 89b6551a428126695c5a6647a6c6fa0b0b074828 Mon Sep 17 00:00:00 2001 From: Aleksey Loginov Date: Mon, 27 May 2024 23:37:54 +0300 Subject: [PATCH 05/11] add benchmark --- src/benchmarks/benchmarks.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/benchmarks/benchmarks.cpp b/src/benchmarks/benchmarks.cpp index 796d019d5..16e959854 100644 --- a/src/benchmarks/benchmarks.cpp +++ b/src/benchmarks/benchmarks.cpp @@ -182,6 +182,17 @@ int main(int argc, char* argv[]) // NOLINT(bugprone-exception-escape) rxcpp::observable<>::just(rxcpp::observable<>::just(1, rxcpp::identity_immediate()), rxcpp::identity_immediate()) | rxcpp::operators::concat() | rxcpp::operators::subscribe([](int v) { ankerl::nanobench::doNotOptimizeAway(v); }); }); } + + SECTION("concat_as_source of just(1 immediate) and just(1,2 immediate)create + subscribe") + { + TEST_RPP([&]() { + rpp::source::concat(rpp::source::just(rpp::schedulers::immediate{}, 1), rpp::source::just(rpp::schedulers::immediate{}, 1, 2)).subscribe([](int v) { ankerl::nanobench::doNotOptimizeAway(v); }); + }); + + TEST_RXCPP([&]() { + rxcpp::observable<>::from(rxcpp::identity_immediate(), rxcpp::observable<>::just(1, rxcpp::identity_immediate()), rxcpp::observable<>::from(rxcpp::identity_immediate(), 1, 2)) | rxcpp::operators::concat() | rxcpp::operators::subscribe([](int v) { ankerl::nanobench::doNotOptimizeAway(v); }); + }); + } SECTION("defer from array of 1 - defer + create + subscribe + immediate") { From 925530c255ac3f763db1d1c5b3b35ef06a254d0e Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 27 May 2024 20:38:17 +0000 Subject: [PATCH 06/11] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/benchmarks/benchmarks.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/benchmarks/benchmarks.cpp b/src/benchmarks/benchmarks.cpp index 16e959854..dfc9cb0fa 100644 --- a/src/benchmarks/benchmarks.cpp +++ b/src/benchmarks/benchmarks.cpp @@ -182,7 +182,7 @@ int main(int argc, char* argv[]) // NOLINT(bugprone-exception-escape) rxcpp::observable<>::just(rxcpp::observable<>::just(1, rxcpp::identity_immediate()), rxcpp::identity_immediate()) | rxcpp::operators::concat() | rxcpp::operators::subscribe([](int v) { ankerl::nanobench::doNotOptimizeAway(v); }); }); } - + SECTION("concat_as_source of just(1 immediate) and just(1,2 immediate)create + subscribe") { TEST_RPP([&]() { From 7b8eb275bd30a0d006a6d808461283516f213f0e Mon Sep 17 00:00:00 2001 From: Aleksey Loginov Date: Mon, 27 May 2024 23:56:46 +0300 Subject: [PATCH 07/11] fix benchmarks --- src/benchmarks/benchmarks.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/benchmarks/benchmarks.cpp b/src/benchmarks/benchmarks.cpp index dfc9cb0fa..e4ce85dc3 100644 --- a/src/benchmarks/benchmarks.cpp +++ b/src/benchmarks/benchmarks.cpp @@ -190,7 +190,7 @@ int main(int argc, char* argv[]) // NOLINT(bugprone-exception-escape) }); TEST_RXCPP([&]() { - rxcpp::observable<>::from(rxcpp::identity_immediate(), rxcpp::observable<>::just(1, rxcpp::identity_immediate()), rxcpp::observable<>::from(rxcpp::identity_immediate(), 1, 2)) | rxcpp::operators::concat() | rxcpp::operators::subscribe([](int v) { ankerl::nanobench::doNotOptimizeAway(v); }); + rxcpp::observable<>::from(rxcpp::identity_immediate(), rxcpp::observable<>::just(1, rxcpp::identity_immediate()).as_dynamic(), rxcpp::observable<>::from(rxcpp::identity_immediate(), 1, 2).as_dynamic()) | rxcpp::operators::concat() | rxcpp::operators::subscribe([](int v) { ankerl::nanobench::doNotOptimizeAway(v); }); }); } From 19682ab73c0315eabc7912e893c2c59cb2059be6 Mon Sep 17 00:00:00 2001 From: Aleksey Loginov Date: Tue, 28 May 2024 00:19:52 +0300 Subject: [PATCH 08/11] compile fix --- src/rpp/rpp/observables/variant_observable.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rpp/rpp/observables/variant_observable.hpp b/src/rpp/rpp/observables/variant_observable.hpp index 37836935a..0c7473dc0 100644 --- a/src/rpp/rpp/observables/variant_observable.hpp +++ b/src/rpp/rpp/observables/variant_observable.hpp @@ -50,7 +50,7 @@ namespace rpp } template - requires (constraint::decayed_any_of) + requires (!constraint::decayed_same_as && constraint::decayed_any_of) variant_observable(T&& o) : base{std::forward(o)} { From d91aaca3ed89b28aa7c683503148ac0f2f42124f Mon Sep 17 00:00:00 2001 From: Aleksey Loginov Date: Tue, 28 May 2024 18:21:13 +0300 Subject: [PATCH 09/11] Update variant_observable.hpp --- src/rpp/rpp/observables/variant_observable.hpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/rpp/rpp/observables/variant_observable.hpp b/src/rpp/rpp/observables/variant_observable.hpp index 0c7473dc0..ecc29a559 100644 --- a/src/rpp/rpp/observables/variant_observable.hpp +++ b/src/rpp/rpp/observables/variant_observable.hpp @@ -50,12 +50,15 @@ namespace rpp } template - requires (!constraint::decayed_same_as && constraint::decayed_any_of) + requires (!constraint::decayed_same_as> && constraint::decayed_any_of) variant_observable(T&& o) : base{std::forward(o)} { } + variant_observable(const variant_observable&) = default; + variant_observable(variant_observable&&) noexcept = default; + using base::base; }; From 90831f238c1de0de2b2d2310a942efff4c78a65e Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 28 May 2024 15:23:05 +0000 Subject: [PATCH 10/11] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/rpp/rpp/observables/variant_observable.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rpp/rpp/observables/variant_observable.hpp b/src/rpp/rpp/observables/variant_observable.hpp index ecc29a559..fd8262a4e 100644 --- a/src/rpp/rpp/observables/variant_observable.hpp +++ b/src/rpp/rpp/observables/variant_observable.hpp @@ -56,7 +56,7 @@ namespace rpp { } - variant_observable(const variant_observable&) = default; + variant_observable(const variant_observable&) = default; variant_observable(variant_observable&&) noexcept = default; using base::base; From 9aa9cceb689ddc9178d740cab73c6800b06a8848 Mon Sep 17 00:00:00 2001 From: Aleksey Loginov Date: Tue, 28 May 2024 22:16:22 +0300 Subject: [PATCH 11/11] fix --- .../rpp/observables/variant_observable.hpp | 25 ++++++++----------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/src/rpp/rpp/observables/variant_observable.hpp b/src/rpp/rpp/observables/variant_observable.hpp index fd8262a4e..06e0bc3cb 100644 --- a/src/rpp/rpp/observables/variant_observable.hpp +++ b/src/rpp/rpp/observables/variant_observable.hpp @@ -20,6 +20,16 @@ namespace rpp::details struct variant_observable_strategy { using value_type = Type; + template TT> + requires (!constraint::decayed_same_as) + explicit variant_observable_strategy(TT&& observable) // NOLINT + : observables(std::forward(observable)) + { + } + + + variant_observable_strategy(const variant_observable_strategy& other) = default; + variant_observable_strategy(variant_observable_strategy&& other) noexcept = default; utils::unique_variant observables; @@ -44,21 +54,6 @@ namespace rpp using base = rpp::observable>; public: - variant_observable(std::variant variant) - : base{std::move(variant)} - { - } - - template - requires (!constraint::decayed_same_as> && constraint::decayed_any_of) - variant_observable(T&& o) - : base{std::forward(o)} - { - } - - variant_observable(const variant_observable&) = default; - variant_observable(variant_observable&&) noexcept = default; - using base::base; };