MeshLib C++ Docs
Loading...
Searching...
No Matches
MR::Unsigned Namespace Reference

Additional support for unsigned types. More...

Functions

template<typename T , std::enable_if_t< std::is_unsigned_v< T >, std::nullptr_t > = nullptr>
constexpr T abs (T value)
 

Detailed Description

Additional support for unsigned types.

Function Documentation

◆ abs()

template<typename T , std::enable_if_t< std::is_unsigned_v< T >, std::nullptr_t > = nullptr>
T MR::Unsigned::abs ( T value)
nodiscardconstexpr

Only callable on unsigned types. Returns the value unchanged. The intended usage of this in templates is like this: using std::abs; using Unsigned::abs; /// Or using namespace Unsigned;. abs(x); Doing it this way ensures that you can handle both signed and unsigned standard types, and additionally any classes that provide abs() via ADL.