blob: 4e4029c4a271fd19a64cb837df53275ca90bb5a4 [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:promote promote]
9
10 template <class T>
11 struct promote
12 {
13 typedef __below type;
14 };
15
16 template <class T> using promote_t = typename promote<T>::type; // C++11 and above
17
18__type If integral or floating point promotion can be applied to an rvalue
19of type `T`, then applies integral and floating point promotions to `T` and
20keeps cv-qualifiers of `T`, otherwise leaves `T` unchanged. See also
21__integral_promotion and __floating_point_promotion.
22
23__std_ref 4.5 except 4.5/3 (integral bit-field) and 4.6.
24
25[all_compilers]
26
27__header ` #include <boost/type_traits/promote.hpp>` or ` #include <boost/type_traits.hpp>`
28
29[table Examples
30
31[ [Expression] [Result Type]]
32
33[[`promote<short volatile>::type`][`int volatile`]]
34
35[[`promote<float const>::type`][`double const`]]
36
37[[`promote<short&>::type`][`short&`]]
38
39]
40
41[endsect]
42