xieite::cast<>

Defined in header <xieite/fn/cast.hpp>

A functor for casting something explicitly.


Declaration

template<typename T>
constexpr auto cast =
	[][[nodiscard]](auto&& x) static
		XIEITE_ARROW(static_cast<T>(x));


Example

int main() {
	double x = 3.14159;
	auto y = xieite::cast<int>(x);
	xieite::dump(y);
}
Output:
3
[View in Compiler Explorer]