CARVIEW |
Select Language
HTTP/1.1 301 Moved Permanently
Server: nginx
Date: Thu, 24 Jul 2025 05:20:46 GMT
Content-Type: text/html; charset=UTF-8
Transfer-Encoding: chunked
Connection: keep-alive
Location: /reference/type_traits/make_unsigned/
HTTP/1.1 200 OK
Server: nginx
Date: Thu, 24 Jul 2025 05:20:46 GMT
Content-Type: text/html; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
ETag: W/"bbba-QUPbxffStLem2wIa25PZKphb7X4"
Content-Encoding: gzip
Obtains the unsigned type corresponding to T, keeping any cv-qualifiers.
The transformed type is aliased as member type make_unsigned::type as follows:
Notice that this class merely obtains a type using another type as model, but it does not transform values or objects between those types. To explicitly cast an integral type to its unsigned equivalent, you can use static_cast.
Output:
Reference
C library:
- <cassert> (assert.h)
- <cctype> (ctype.h)
- <cerrno> (errno.h)
-
<cfenv> (fenv.h)C++11
- <cfloat> (float.h)
-
<cinttypes> (inttypes.h)C++11
- <ciso646> (iso646.h)
- <climits> (limits.h)
- <clocale> (locale.h)
- <cmath> (math.h)
- <csetjmp> (setjmp.h)
- <csignal> (signal.h)
- <cstdarg> (stdarg.h)
-
<cstdbool> (stdbool.h)C++11
- <cstddef> (stddef.h)
-
<cstdint> (stdint.h)C++11
- <cstdio> (stdio.h)
- <cstdlib> (stdlib.h)
- <cstring> (string.h)
-
<ctgmath> (tgmath.h)C++11
- <ctime> (time.h)
-
<cuchar> (uchar.h)C++11
- <cwchar> (wchar.h)
- <cwctype> (wctype.h)
Containers:
-
<array>C++11
- <deque>
-
<forward_list>C++11
- <list>
- <map>
- <queue>
- <set>
- <stack>
-
<unordered_map>C++11
-
<unordered_set>C++11
- <vector>
-
Input/Output:
Multi-threading:
-
<atomic>C++11
-
<condition_variable>C++11
-
<future>C++11
-
<mutex>C++11
-
<thread>C++11
-
Other:
- <algorithm>
- <bitset>
-
<chrono>C++11
-
<codecvt>C++11
- <complex>
- <exception>
- <functional>
-
<initializer_list>C++11
- <iterator>
- <limits>
- <locale>
- <memory>
- <new>
- <numeric>
-
<random>C++11
-
<ratio>C++11
-
<regex>C++11
- <stdexcept>
- <string>
-
<system_error>C++11
-
<tuple>C++11
-
<type_traits>C++11
-
<typeindex>C++11
- <typeinfo>
- <utility>
- <valarray>
<type_traits>
helper classes
-
false_typeC++11
-
integral_constantC++11
-
true_typeC++11
-
type traits
-
alignment_ofC++11
-
extentC++11
-
has_virtual_destructorC++11
-
is_abstractC++11
-
is_arithmeticC++11
-
is_arrayC++11
-
is_assignableC++11
-
is_base_ofC++11
-
is_classC++11
-
is_compoundC++11
-
is_constC++11
-
is_constructibleC++11
-
is_convertibleC++11
-
is_copy_assignableC++11
-
is_copy_constructibleC++11
-
is_default_constructibleC++11
-
is_destructibleC++11
-
is_emptyC++11
-
is_enumC++11
-
is_floating_pointC++11
-
is_functionC++11
-
is_fundamentalC++11
-
is_integralC++11
-
is_literal_typeC++11
-
is_lvalue_referenceC++11
-
is_member_function_pointerC++11
-
is_member_object_pointerC++11
-
is_member_pointerC++11
-
is_move_assignableC++11
-
is_move_constructibleC++11
-
is_nothrow_assignableC++11
-
is_nothrow_constructibleC++11
-
is_nothrow_copy_assignableC++11
-
is_nothrow_copy_constructibleC++11
-
is_nothrow_default_constructibleC++11
-
is_nothrow_destructibleC++11
-
is_nothrow_move_assignableC++11
-
is_nothrow_move_constructibleC++11
-
is_null_pointerC++14
-
is_objectC++11
-
is_podC++11
-
is_pointerC++11
-
is_polymorphicC++11
-
is_referenceC++11
-
is_rvalue_referenceC++11
-
is_sameC++11
-
is_scalarC++11
-
is_signedC++11
-
is_standard_layoutC++11
-
is_trivialC++11
-
is_trivially_assignableC++11
-
is_trivially_constructibleC++11
-
is_trivially_copy_assignableC++11
-
is_trivially_copy_constructibleC++11
-
is_trivially_copyableC++11
-
is_trivially_default_constructibleC++11
-
is_trivially_destructibleC++11
-
is_trivially_move_assignableC++11
-
is_trivially_move_constructibleC++11
-
is_unionC++11
-
is_unsignedC++11
-
is_voidC++11
-
is_volatileC++11
-
rankC++11
-
type transformations
-
add_constC++11
-
add_cvC++11
-
add_lvalue_referenceC++11
-
add_pointerC++11
-
add_rvalue_referenceC++11
-
add_volatileC++11
-
aligned_storageC++11
-
aligned_unionC++11
-
common_typeC++11
-
conditionalC++11
-
decayC++11
-
enable_ifC++11
-
make_signedC++11
-
make_unsignedC++11
-
remove_all_extentsC++11
-
remove_constC++11
-
remove_cvC++11
-
remove_extentC++11
-
remove_pointerC++11
-
remove_referenceC++11
-
remove_volatileC++11
-
result_ofC++11
-
underlying_typeC++11
-
- Reference
- <type_traits>
- make_unsigned
class template
<type_traits>
std::make_unsigned
template <class T> struct make_unsigned;
Make unsigned
The transformed type is aliased as member type make_unsigned::type as follows:
- If T is a signed integral type, this is the corresponding unsigned type.
- If T is already an unsigned integral type, this is T unchanged.
- If T is an enumeration type, this is the smallest unsigned integer type with the same size as T (as per sizeof operator).
Notice that this class merely obtains a type using another type as model, but it does not transform values or objects between those types. To explicitly cast an integral type to its unsigned equivalent, you can use static_cast.
Template parameters
- T
- An integer type (except bool), or an enumeration type.
Member types
member type | definition |
---|---|
type | Unsigned type corresponding to T. |
Example
|
|
Output:
typedefs of unsigned int: A: true B: true C: false D: true E: false |
See also
- make_signed
- Make signed (class template)
- is_unsigned
- Is unsigned type (class template)
- add_const
- Add const qualification (class template)
Home page | Privacy policy
© cplusplus.com, 2000-2025 - All rights reserved - v3.3.4s
Spotted an error? contact us
© cplusplus.com, 2000-2025 - All rights reserved - v3.3.4s
Spotted an error? contact us