tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
conditional.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSL-1.0
2// SPDX-FileCopyrightText: Copyright (C) 2019 Tobias Hienzsch
3
4#ifndef TETL_TYPE_TRAITS_CONDITIONAL_HPP
5#define TETL_TYPE_TRAITS_CONDITIONAL_HPP
6
7namespace etl {
8
9/// \brief Provides member typedef type, which is defined as T if B is true at
10/// compile time, or as F if B is false.
11/// \ingroup type_traits
12template <bool B, typename T, typename F>
14 using type = T;
15};
16
17template <typename T, typename F>
18struct conditional<false, T, F> {
19 using type = F;
20};
21
22/// \ingroup type_traits
23/// \relates conditional
24template <bool B, typename T, typename F>
25using conditional_t = typename conditional<B, T, F>::type;
26
27} // namespace etl
28
29#endif // TETL_TYPE_TRAITS_CONDITIONAL_HPP
Definition adjacent_find.hpp:9
Provides member typedef type, which is defined as T if B is true at compile time, or as F if B is fal...
Definition conditional.hpp:13