MeshLib C++ Docs
Loading...
Searching...
No Matches
MRUnsigned.h
Go to the documentation of this file.
1
#pragma once
2
3
#include <cstddef>
4
#include <type_traits>
5
6
// Additional support for unsigned types.
7
8
namespace
MR::Unsigned
9
{
10
11
// Only callable on unsigned types. Returns the value unchanged.
12
// The intended usage of this in templates is like this:
13
// using std::abs;
14
// using Unsigned::abs; // Or `using namespace Unsigned;`.
15
// abs(x);
16
// Doing it this way ensures that you can handle both signed and unsigned standard types, and additionally any classes that provide `abs()` via ADL.
17
template
<
typename
T, std::enable_if_t<std::is_
unsigned
_v<T>, std::
nullptr
_t> =
nullptr
>
18
[[nodiscard]]
constexpr
T
abs
( T value )
19
{
20
return
value;
21
}
22
23
}
MR::Unsigned
Definition
MRUnsigned.h:9
MR::Unsigned::abs
constexpr T abs(T value)
Definition
MRUnsigned.h:18
MeshLib
source
MRMesh
MRUnsigned.h
Generated by
1.11.0