ReactivePlusPlus
One more implementation of ReactiveX approach in C++ with care about performance and templates in mind
 
Loading...
Searching...
No Matches
switch_map.hpp
1// ReactivePlusPlus library
2//
3// Copyright Aleksey Loginov 2022 - present.
4// TC Wang 2022 - present.
5// Distributed under the Boost Software License, Version 1.0.
6// (See accompanying file LICENSE_1_0.txt or copy at
7// https://www.boost.org/LICENSE_1_0.txt)
8//
9// Project home: https://github.com/victimsnino/ReactivePlusPlus
10//
11
12#pragma once
13
14#include <rpp/operators/map.hpp>
15#include <rpp/operators/switch_on_next.hpp>
16#include <rpp/operators/fwd/switch_map.hpp>
17
18IMPLEMENTATION_FILE(switch_map_tag);
19
20namespace rpp::details
21{
22template<constraint::decayed_type Type, switch_map_callable<Type> Callable>
23auto switch_map_impl(auto &&observable, Callable &&callable)
24{
25 return std::forward<decltype(observable)>(observable)
26 .map(std::forward<Callable>(callable))
27 .switch_on_next();
28}
29} // namespace rpp::details