tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
integral_constant.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSL-1.0
2
3#ifndef TETL_TYPE_TRAITS_INTEGRAL_CONSTANT_HPP
4#define TETL_TYPE_TRAITS_INTEGRAL_CONSTANT_HPP
5
6namespace etl {
7
8template <typename Type, Type Val>
10 static constexpr Type value = Val;
11 using value_type = Type;
13
14 constexpr operator value_type() const noexcept { return value; }
15
16 constexpr auto operator()() const noexcept -> value_type { return value; }
17};
18
19template <typename Rhs, Rhs R, typename Lhs, Lhs L>
20[[nodiscard]] constexpr auto operator+(integral_constant<Rhs, R> /*l*/, integral_constant<Lhs, L> /*r*/)
21 -> integral_constant<decltype(L + R), L + R>
22{
23 return {};
24}
25
26template <typename Rhs, Rhs R, typename Lhs, Lhs L>
27[[nodiscard]] constexpr auto operator==(integral_constant<Rhs, R> /*l*/, integral_constant<Lhs, L> /*r*/)
29{
30 return {};
31}
32
33template <typename Rhs, Rhs R, typename Lhs, Lhs L>
34[[nodiscard]] constexpr auto operator!=(integral_constant<Rhs, R> /*l*/, integral_constant<Lhs, L> /*r*/)
36{
37 return {};
38}
39
40} // namespace etl
41
42#endif // TETL_TYPE_TRAITS_INTEGRAL_CONSTANT_HPP
Definition adjacent_find.hpp:8
constexpr auto operator==(inplace_function< R(Args...), Capacity, Alignment > const &f, nullptr_t) noexcept -> bool
Compares a etl::inplace_function with a null pointer. Empty functions (that is, functions without a c...
Definition inplace_function.hpp:262
constexpr auto operator!=(inplace_function< R(Args...), Capacity, Alignment > const &f, nullptr_t) noexcept -> bool
Compares a etl::inplace_function with a null pointer. Empty functions (that is, functions without a c...
Definition inplace_function.hpp:272
constexpr auto operator+(complex< T > const &val) -> complex< T >
Definition complex.hpp:256
Definition integral_constant.hpp:9
constexpr auto operator()() const noexcept -> value_type
Definition integral_constant.hpp:16
static constexpr size_t value
Definition integral_constant.hpp:10
integral_constant< size_t, Val > type
Definition integral_constant.hpp:12
size_t value_type
Definition integral_constant.hpp:11