17 #ifndef OPENKALMAN_VALUES_FIXED_VALUE_HPP 18 #define OPENKALMAN_VALUES_FIXED_VALUE_HPP 34 template<
typename C,
auto...constant> requires
35 (
sizeof...(constant) == 1 and requires {
static_cast<C
>((constant,...)); }) or
36 (not complex<C> or std::bool_constant<(interface::number_traits<std::decay_t<C>>::make_complex(constant...),
sizeof...(constant) == 2)>
::value) or
37 (complex<C> or std::bool_constant<(C{constant...},
true)>::
value)
39 template<
typename C,
auto...constant>
43 static constexpr
auto value = []
45 if constexpr (
sizeof...(constant) == 1)
return static_cast<C
>((constant,...));
47 else return C {constant...};
51 using value_type = std::decay_t<decltype(value)>;
57 constexpr
operator value_type()
const {
return value; }
60 constexpr value_type operator()()
const {
return value; }
67 template<fixed T> requires (fixed_value_of_v<T> == value)
75 template<fixed T> requires (fixed_value_of_v<T> == value)
77 template<typename T, std::enable_if_t<fixed_value_of<T>::value == value,
int> = 0>
79 constexpr
fixed_value& operator=(
const T&) {
return *
this; }
89 template<fixed T> requires (not complex<T>)
91 template<
typename T, std::enable_if_t<fixed<T> and not complex<T>,
int> = 0>
100 #ifdef __cpp_concepts 101 template<fixed T> requires complex<T>
103 template<
typename T, std::enable_if_t<fixed<T> and complex<T>,
int> = 0>
Definition: fixed_value.hpp:41
constexpr bool value
T is a fixed or dynamic value that is reducible to a number.
Definition: value.hpp:45
constexpr auto imag(const Arg &arg)
A constexpr function to obtain the imaginary part of a (complex) number.
Definition: imag.hpp:40
Definition for values::imag.
constexpr auto real(const Arg &arg)
A constexpr function to obtain the real part of a (complex) number.
Definition: real.hpp:40
Definition for values::abs.
Definition: fixed-constants.hpp:23
Definition for values::real.
Definition: number_traits.hpp:36
Traits for arithmetic and complex scalar types.
Definition for values::complex.