PrevUpHomeNext

utx::in_scope, utx::lt_scope, utx::gt_scope


utx::in_scope

template <
    utx::kspt::real_number T,
    utx::kspt::real_number U,
    utx::kspt::real_number V
>
inline constexpr bool utx::in_scope(const T & x, const U & a, const V & b);

Check if x is in scope [a, b], including a and b.

utx::lt_scope

template <
    utx::kspt::real_number T,
    utx::kspt::real_number U,
    utx::kspt::real_number V
>
inline constexpr bool utx::lt_scope(const T & x, const U & a, const V & b);

Check if x is not in scope [a, b] and less than a and b.

utx::gt_scope

template <
    utx::kspt::real_number T,
    utx::kspt::real_number U,
    utx::kspt::real_number V
>
inline constexpr bool utx::gt_scope(const T & x, const U & a, const V & b);

Check if x is not in scope [a, b] and greater than a and b.

Example

#include <utxcpp/core.hpp>
#include <numbers>

int main() {
	constexpr utx::i32 x = -123;
	constexpr utx::u16 y = 321;
	constexpr utx::f64 z = std::numbers::pi;
	constexpr utx::u32 w = 321;

	static_assert(utx::in_scope(z, x, y));
	static_assert(utx::lt_scope(x, y, z));
	static_assert(utx::gt_scope(w, x, z));

	static_assert(utx::in_scope(w, x, y));
	static_assert(utx::in_scope(w, y, x));

	static_assert(!utx::gt_scope(w, x, y));
	static_assert(!utx::lt_scope(w, w, w));
	static_assert(utx::in_scope(w, w, w));
}

Last revised: November 24, 2022 at 11:26:05 GMT


PrevUpHomeNext