ReactivePlusPlus
One more implementation of ReactiveX approach in C++ with care about performance and templates in mind
 
Loading...
Searching...
No Matches
constraints.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/observables/fwd.hpp>
14
15#include <concepts>
16
17namespace rpp::constraint
18{
19template<typename T> concept observable = std::derived_from<std::decay_t<T>, details::observable_tag>;
20}
21
22namespace rpp::utils
23{
24namespace details
25{
26 template<rpp::constraint::observable T>
28 {
29 template<typename TT>
30 static TT deduce(const rpp::details::typed_observable_tag<TT>&);
31
32 using type = decltype(deduce(std::declval<std::decay_t<T>>()));
33 };
34} // namespace details
35
36template<rpp::constraint::observable T>
37using extract_observable_type_t = typename details::extract_observable_type<T>::type;
38} // namespace rpp::utils
39
40namespace rpp::constraint
41{
42template<typename T, typename Type> concept observable_of_type = observable<T> && std::same_as<utils::extract_observable_type_t<T>, Type>;
43} // namespace rpp::constraint
Definition: constraints.hpp:42
Definition: constraints.hpp:19
Definition: constraints.hpp:28