tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
common_reference.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSL-1.0
2
3#ifndef TETL_TYPE_TRAITS_COMMON_REFERENCE_HPP
4#define TETL_TYPE_TRAITS_COMMON_REFERENCE_HPP
5
9
10namespace etl {
11
17template <typename... T>
19
20// if sizeof...(T) is zero
21template <>
22struct common_reference<> { };
23
24// if sizeof...(T) is one
25template <typename T>
27 using type = T;
28};
29
31template <typename T, typename U>
32 requires is_same_v<T, U>
33struct common_reference<T, U> {
34 using type = T;
35};
36
37template <typename... T>
38using common_reference_t = typename common_reference<T...>::type;
39
40} // namespace etl
41
42#endif // TETL_TYPE_TRAITS_COMMON_REFERENCE_HPP
Definition adjacent_find.hpp:8
constexpr bool is_same_v
Definition is_same.hpp:11
typename common_reference< T... >::type common_reference_t
Definition common_reference.hpp:38
T type
Definition common_reference.hpp:34
T type
Definition common_reference.hpp:27
Determines the common reference type of the types T..., that is, the type to which all the types in T...
Definition common_reference.hpp:18