ReactivePlusPlus
One more implementation of ReactiveX approach in C++ with care about performance and templates in mind
 
Loading...
Searching...
No Matches
start_with.hpp
1// ReactivePlusPlus library
2//
3// Copyright Aleksey Loginov 2022 - present.
4// Distributed under the Boost Software License, Version 1.0.
5// (See accompanying file LICENSE_1_0.txt or copy at
6// https://www.boost.org/LICENSE_1_0.txt)
7//
8// Project home: https://github.com/victimsnino/ReactivePlusPlus
9//
10
11#pragma once
12
13#include <rpp/operators/concat.hpp>
14#include <rpp/operators/fwd/start_with.hpp>
15#include <rpp/sources/just.hpp>
16
17IMPLEMENTATION_FILE (start_with_tag);
18
19namespace rpp::details
20{
21template<constraint::decayed_type Type, constraint::observable_of_type<Type> TObservable, constraint::observable_of_type<Type> ...TObservables>
22auto start_with_impl(TObservable&& observable, TObservables&&... observables_to_start_with)
23{
24 return concat_with_impl<Type>(std::forward<TObservables>(observables_to_start_with)..., std::forward<TObservable>(observable));
25}
26
27template<rpp::memory_model memory_model, constraint::decayed_type Type, constraint::decayed_same_as<Type> ...TTypes, constraint::observable_of_type<Type> TObservable>
28auto start_with_impl(TObservable&& observable, TTypes&& ...vals_to_start_with)
29{
30 return start_with_impl<Type>(std::forward<TObservable>(observable), rpp::source::just<memory_model>(std::forward<TTypes>(vals_to_start_with)...));
31}
32} // namespace rpp::details