E.V.E
v2023.02.15
 
Loading...
Searching...
No Matches

◆ as_value

callable_as_value_ eve::as_value = {}
inlineconstexpr

Defined in Header

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
template< eve::value From, eve::value T >
T as_value(From x, eve::as<T> t) noexcept;
}
constexpr callable_as_value_ as_value
converts eve constant or just a value to a type.
Definition as_value.hpp:54
EVE Main Namespace.
Definition abi.hpp:18
Lightweight type-wrapper.
Definition as.hpp:29

Parameters

  • x: either something convertible to T or an of eve constant
  • t : Type wrapper instance embedding the type of the constant.

Return value

The call eve::as_value(as<T>()) returns a value of type T which is the conversion of x to type Target or the the eve constant of type Target.

Example

#include <eve/module/core.hpp>
#include <eve/wide.hpp>
#include <iostream>
int main()
{
std::cout << "---- simd" << '\n'
<< "<- as_value(pf, as<wide_ft>()) = " << eve::as_value(32.5, eve::as<wide_ft>()) << '\n'
<< "<- as_value(valmax, as<wide_it>()) = " << eve::as_value(eve::valmax, eve::as<wide_it>()) << '\n'
;
double xf = -62768.0f;
std::cout << "---- scalar" << '\n'
<< "<- as_value(xf, as<float>()) = " << eve::as_value(xf, eve::as<float>()) << '\n'
<< "<- as_value(xf, as<int16_t>()) = " << eve::as_value(xf, eve::as<int16_t>()) << '\n';
return 0;
}
constexpr auto valmax
Computes the the greatest representable value.
Definition valmax.hpp:66
Wrapper for SIMD registers.
Definition wide.hpp:86