]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | [/ |
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_signed make_signed] | |
9 | ||
10 | template <class T> | |
11 | struct make_signed | |
12 | { | |
13 | typedef __below type; | |
14 | }; | |
15 | ||
16 | __type If T is a signed integer type then the same type as T, if T is an | |
17 | unsigned integer type then the corresponding signed type. | |
18 | Otherwise if T is an enumerated or | |
19 | character type (char or wchar_t) then a signed integer type with the same | |
20 | width as T. | |
21 | ||
22 | If T has any cv-qualifiers then these are also present on the result type. | |
23 | ||
24 | [*Requires:] T must be an integer or enumerated type, and must not be the type | |
25 | bool. | |
26 | ||
27 | __std_ref 3.9.1. | |
28 | ||
29 | [all_compilers] | |
30 | ||
31 | __header ` #include <boost/type_traits/make_signed.hpp>` or ` #include <boost/type_traits.hpp>` | |
32 | ||
33 | [table Examples | |
34 | ||
35 | [ [Expression] [Result Type]] | |
36 | ||
37 | [[`make_signed<int>::type`][`int`]] | |
38 | ||
39 | [[`make_signed<unsigned int const>::type`] [`int const`]] | |
40 | ||
41 | [[`make_signed<const unsigned long long>::type`] [`const long long`]] | |
42 | ||
43 | [[`make_signed<my_enum>::type`] [A signed integer type with the same width as the enum.]] | |
44 | [[`make_signed<wchar_t>::type`] [A signed integer type with the same width as wchar_t.]] | |
45 | ||
46 | ] | |
47 | ||
48 | [endsect] | |
49 |