Go to the documentation of this file. 1 #ifndef EAGINE_MATH_SCALAR_HPP
9 #define EAGINE_MATH_SCALAR_HPP
11 #include "../type_identity.hpp"
12 #include "../vect/data.hpp"
13 #include "../vect/fill.hpp"
15 #include <type_traits>
23 template <
typename T,
int N,
bool V>
34 std::conditional_t<is_vectorized::value, vect::data_t<T, N, V>, T>;
40 static constexpr
auto _from(data_type v) noexcept {
44 static constexpr
auto _make(T v, std::true_type) noexcept {
45 return scalar{vect::fill<T, N, V>::apply(v)};
48 static constexpr
auto _make(T v, std::false_type) noexcept {
53 static constexpr
auto make(T v) noexcept {
57 constexpr
auto _get(std::true_type)
const noexcept -> T {
61 constexpr
auto _get(std::false_type)
const noexcept -> T {
66 constexpr
operator T() const noexcept {
72 return *
this =
make(v);
78 #endif // EAGINE_MATH_SCALAR_HPP
auto operator=(T v) noexcept -> scalar &
Assignment from the value type.
Definition: scalar.hpp:71
T value_type
The scalar element type.
Definition: scalar.hpp:28
static constexpr auto make(T v) noexcept
Creates a scalar with the specified value.
Definition: scalar.hpp:53
Math-related code is placed in this namespace.
Definition: eagine.hpp:48
vect::has_vect_data_t< T, N, V > is_vectorized
Indicates if the implementation uses SIMD extensions.
Definition: scalar.hpp:31
Basic scalar implementation template.
Definition: fwd.hpp:16