blob: a4d7774ee12ab56f479ebdcb51187c9c8504b291 [file] [log] [blame]
Brian Silverman4a2409e2018-08-04 23:24:02 -07001[/
2 Copyright 2007 John Maddock.
3 Distributed under the Boost Software License, Version 1.0.
4 (See accompanying file LICENSE_1_0.txt or copy at
5 http://www.boost.org/LICENSE_1_0.txt).
6]
7
8[section:make_unsigned make_unsigned]
9
10 template <class T>
11 struct make_unsigned
12 {
13 typedef __below type;
14 };
15
16 template <class T> using make_unsigned_t = typename make_unsigned<T>::type; // C++11 and above
17
18__type If T is a unsigned integer type then the same type as T, if T is an
19signed integer type then the corresponding unsigned type.
20Otherwise if T is an enumerated or
21character type (char or wchar_t) then an unsigned integer type with the same
22width as T.
23
24If T has any cv-qualifiers then these are also present on the result type.
25
26[*Requires:] T must be an integer or enumerated type, and must not be the type
27bool.
28
29__std_ref 3.9.1.
30
31[all_compilers]
32
33__header ` #include <boost/type_traits/make_unsigned.hpp>` or ` #include <boost/type_traits.hpp>`
34
35[table Examples
36
37[ [Expression] [Result Type]]
38
39[[`make_unsigned<int>::type`][`unsigned int`]]
40
41[[`make_unsigned<unsigned int const>::type`] [`unsigned int const`]]
42
43[[`make_unsigned<const unsigned long long>::type`] [`const unsigned long long`]]
44
45[[`make_unsigned<my_enum>::type`] [An unsigned integer type with the same width as the enum.]]
46[[`make_unsigned<wchar_t>::type`] [An unsigned integer type with the same width as wchar_t.]]
47
48]
49
50[endsect]
51