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