add type trait to check type size in bits
This commit is contained in:
parent
e7c6032edb
commit
c450600097
|
@ -84,19 +84,19 @@ namespace detail {
|
|||
}
|
||||
|
||||
template<typename T>
|
||||
static constexpr T NumericLimitMin = detail::NumericLimitsBase<T>::minv;
|
||||
constexpr T NumericLimitMin = detail::NumericLimitsBase<T>::minv;
|
||||
|
||||
template<typename T>
|
||||
static constexpr T NumericLimitMax = detail::NumericLimitsBase<T>::maxv;
|
||||
constexpr T NumericLimitMax = detail::NumericLimitsBase<T>::maxv;
|
||||
|
||||
template<typename T>
|
||||
static constexpr T NumericLimitLowest = detail::NumericLimitsBase<T>::lowv;
|
||||
constexpr T NumericLimitLowest = detail::NumericLimitsBase<T>::lowv;
|
||||
|
||||
template<typename T>
|
||||
static constexpr bool NumericLimitIsSigned = detail::NumericLimitsBase<T>::is_signed;
|
||||
constexpr bool NumericLimitIsSigned = detail::NumericLimitsBase<T>::is_signed;
|
||||
|
||||
template<typename T>
|
||||
static constexpr bool NumericLimitIsInteger = detail::NumericLimitsBase<T>::is_integer;
|
||||
constexpr bool NumericLimitIsInteger = detail::NumericLimitsBase<T>::is_integer;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#ifndef OSTD_TYPE_TRAITS_HH
|
||||
#define OSTD_TYPE_TRAITS_HH
|
||||
|
||||
#include <limits.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include "ostd/types.hh"
|
||||
|
@ -55,6 +56,11 @@ namespace detail {
|
|||
AddRvalueReference<T> declval_in() noexcept;
|
||||
}
|
||||
|
||||
/* size in bits */
|
||||
|
||||
template<typename T>
|
||||
constexpr Size SizeInBits = sizeof(T) * CHAR_BIT;
|
||||
|
||||
/* integral constant */
|
||||
|
||||
template<typename T, T val>
|
||||
|
|
Loading…
Reference in a new issue