From 06dc966f19a615011492c58d617312a358455c3f Mon Sep 17 00:00:00 2001 From: q66 Date: Mon, 8 Jun 2015 20:45:49 +0100 Subject: [PATCH] explicit-size type aliases + do not expose uint etc into global namespace --- octa/type_traits.h | 6 ++--- octa/types.h | 58 +++++++++++++++++++++++++++++++++++++++------- 2 files changed, 52 insertions(+), 12 deletions(-) diff --git a/octa/type_traits.h b/octa/type_traits.h index eec8ca8..5e4a0be 100644 --- a/octa/type_traits.h +++ b/octa/type_traits.h @@ -646,19 +646,19 @@ template struct IsSame: True {}; /* extent */ -template +template struct Extent: IntegralConstant {}; template struct Extent: IntegralConstant {}; -template +template struct Extent: IntegralConstant::value> {}; template struct Extent: IntegralConstant {}; -template +template struct Extent: IntegralConstant::value> {}; /* rank */ diff --git a/octa/types.h b/octa/types.h index 2623300..e147ec7 100644 --- a/octa/types.h +++ b/octa/types.h @@ -11,6 +11,8 @@ namespace octa { +/* "builtin" types */ + using schar = signed char; using uchar = unsigned char; using ushort = unsigned short; @@ -21,23 +23,61 @@ using llong = long long; using ldouble = long double; +/* nullptr type */ + using Nullptr = decltype(nullptr); +/* max align */ + #if defined(__CLANG_MAX_ALIGN_T_DEFINED) || defined(_GCC_MAX_ALIGN_T) using MaxAlign = ::max_align_t; #else using MaxAlign = long double; #endif +/* stddef */ + +using Ptrdiff = ptrdiff_t; +using Size = size_t; + +/* stdint */ + +using Intmax = intmax_t; +using Uintmax = uintmax_t; + +using Intptr = intptr_t; +using Uintptr = uintptr_t; + +using Int8 = int8_t; +using Int16 = int16_t; +using Int32 = int32_t; +using Int64 = int64_t; + +using Uint8 = uint8_t; +using Uint16 = uint16_t; +using Uint32 = uint32_t; +using Uint64 = uint64_t; + +using IntLeast8 = int_least8_t; +using IntLeast16 = int_least16_t; +using IntLeast32 = int_least32_t; +using IntLeast64 = int_least64_t; + +using UintLeast8 = uint_least8_t; +using UintLeast16 = uint_least16_t; +using UintLeast32 = uint_least32_t; +using UintLeast64 = uint_least64_t; + +using IntFast8 = int_fast8_t; +using IntFast16 = int_fast16_t; +using IntFast32 = int_fast32_t; +using IntFast64 = int_fast64_t; + +using UintFast8 = uint_fast8_t; +using UintFast16 = uint_fast16_t; +using UintFast32 = uint_fast32_t; +using UintFast64 = uint_fast64_t; + } -using octa::schar; -using octa::uchar; -using octa::ushort; -using octa::uint; -using octa::ulong; -using octa::ullong; -using octa::llong; -using octa::ldouble; - #endif \ No newline at end of file