// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. #pragma once /*! \file rx-start_with.hpp \brief Start with the supplied values, then concatenate this observable. \tparam Value0 ... \tparam ValueN the type of sending values \param v0 ... \param vn values to send \return Observable that emits the specified items and then emits the items emitted by the source observable. \sample \snippet start_with.cpp short start_with sample \snippet output.txt short start_with sample Another form of this operator, rxcpp::observable::start_with, gets the source observable as a parameter: \snippet start_with.cpp full start_with sample \snippet output.txt full start_with sample */ #if !defined(RXCPP_OPERATORS_RX_START_WITH_HPP) #define RXCPP_OPERATORS_RX_START_WITH_HPP #include "../rx-includes.hpp" #include "./rx-concat.hpp" namespace rxcpp { namespace operators { namespace detail { template struct start_with_invalid_arguments {}; template struct start_with_invalid : public rxo::operator_base> { using type = observable, start_with_invalid>; }; template using start_with_invalid_t = typename start_with_invalid::type; } /*! @copydoc rx-start_with.hpp */ template auto start_with(AN&&... an) -> operator_factory { return operator_factory(std::make_tuple(std::forward(an)...)); } } template<> struct member_overload { template>, class From = decltype(rxs::from(rxu::decay_t(std::declval()), rxu::decay_t(std::declval())...)) > static auto member(Observable&& o, Value0&& v0, ValueN&&... vn) -> decltype(member_overload::member(std::declval(), std::forward(o))) { auto first = rxs::from(rxu::decay_t(v0), rxu::decay_t(vn)...); return member_overload::member(first, std::forward(o)); } template static operators::detail::start_with_invalid_t member(const AN&...) { std::terminate(); return {}; static_assert(sizeof...(AN) == 10000, "start_with takes (Value0, optional ValueN...)"); } }; } #endif