My Project
make_unsigned.hpp
Go to the documentation of this file.
1 
28 #ifndef BSL_MAKE_UNSIGNED_HPP
29 #define BSL_MAKE_UNSIGNED_HPP
30 
31 #include "cstdint.hpp"
32 
33 namespace bsl
34 {
52  template<typename T>
53  struct make_unsigned final
54  {};
55 
57  template<typename T>
59 
61 
62  template<>
63  struct make_unsigned<bsl::int8> final
64  {
66  using type = bsl::uint8;
67  };
68 
69  template<>
70  struct make_unsigned<bsl::int8 const> final
71  {
73  using type = bsl::uint8 const;
74  };
75 
76  template<>
77  struct make_unsigned<bsl::int16> final
78  {
80  using type = bsl::uint16;
81  };
82 
83  template<>
84  struct make_unsigned<bsl::int16 const> final
85  {
87  using type = bsl::uint16 const;
88  };
89 
90  template<>
91  struct make_unsigned<bsl::int32> final
92  {
94  using type = bsl::uint32;
95  };
96 
97  template<>
98  struct make_unsigned<bsl::int32 const> final
99  {
101  using type = bsl::uint32 const;
102  };
103 
104  template<>
105  struct make_unsigned<bsl::int64> final
106  {
108  using type = bsl::uint64;
109  };
110 
111  template<>
112  struct make_unsigned<bsl::int64 const> final
113  {
115  using type = bsl::uint64 const;
116  };
117 
119 }
120 
121 #endif
::uint8_t uint8
defines an 8bit unsigned integer
Definition: cstdint.hpp:45
::uint16_t uint16
defines an 16bit unsigned integer
Definition: cstdint.hpp:47
::int64_t int64
defines an 64bit signed integer
Definition: cstdint.hpp:42
::int16_t int16
defines an 16bit signed integer
Definition: cstdint.hpp:38
::uint32_t uint32
defines an 32bit unsigned integer
Definition: cstdint.hpp:49
typename make_unsigned< T >::type make_unsigned_t
a helper that reduces the verbosity of bsl::make_unsigned
Definition: make_unsigned.hpp:58
::int8_t int8
defines an 8bit signed integer
Definition: cstdint.hpp:36
::int32_t int32
defines an 32bit signed integer
Definition: cstdint.hpp:40
If the provided type is an signed type (taking into account const qualifications),...
Definition: make_unsigned.hpp:53
::uint64_t uint64
defines an 64bit unsigned integer
Definition: cstdint.hpp:51