Utility required by other ugmisc headers. More...
#include <limits>#include <type_traits>#include <utility>Go to the source code of this file.
Typedefs | |
| template<class T> | |
| using | ugmisc::remove_cvref_t = std::remove_cv_t<std::remove_reference_t<T>> |
| template<class T> | |
| using | ugmisc::plain_ref_t = std::remove_cv_t<T>& |
| template<class T, class R = T> | |
| using | ugmisc::uint_only |
| Resolves to R if T is an unsigned integer. | |
| template<class T, class R = T> | |
| using | ugmisc::modulo_uint_only |
| Resolves to R if T is an unsigned integer with modulo arithmetic. | |
| template<class T, class R = T> | |
| using | ugmisc::bitwise_uint_only |
| template<class T, class R = T> | |
| using | ugmisc::int_only |
Functions | |
| template<class T> | |
| plain_ref_t< T > | ugmisc::decl_plain_ref () |
Utility required by other ugmisc headers.
The miscellaneous templates often want to be selected only when a type parameter is an integral type, or some similar condition. Since many of them use the same condition, it makes sense to make a special helper for that condition, which makes the declarations that use it a bit more legible.
| using ugmisc::bitwise_uint_only |
This type alias attempts to be valid only in cases where T supports bitwise operators, and where those operators work in the way you would normally expect.
In practice this could let some odd things slip through the net. If you create a type with a std::numeric_limits specialisation such that it claims to be an unsigned integer with a radix of 2, and it supports the |, &, ^, and ~ operators, but those operators don't do what someone would normally expect, then that could cause a problem.
| using ugmisc::int_only |
Resolves to R if T is an integer.
| using ugmisc::modulo_uint_only |
Resolves to R if T is an unsigned integer with modulo arithmetic.
| using ugmisc::uint_only |
Resolves to R if T is an unsigned integer.