Brian Silverman | 4a2409e | 2018-08-04 23:24:02 -0700 | [diff] [blame^] | 1 | [/ |
| 2 | Copyright 2015 Peter Dimov. |
| 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:copy_cv copy_cv] |
| 9 | |
| 10 | template <class T, class U> |
| 11 | struct copy_cv |
| 12 | { |
| 13 | typedef __below type; |
| 14 | }; |
| 15 | |
| 16 | template <class T, class U> using copy_cv_t = typename copy_cv<T, U>::type; // C++11 and above |
| 17 | |
| 18 | __type [^T /cv/], where /cv/ are the cv-qualifiers of `U`. |
| 19 | |
| 20 | __header ` #include <boost/type_traits/copy_cv.hpp>` or ` #include <boost/type_traits.hpp>` |
| 21 | |
| 22 | [table Examples |
| 23 | |
| 24 | [ [Expression] [Result Type]] |
| 25 | |
| 26 | [[`copy_cv<int, void>::type`][`int`]] |
| 27 | |
| 28 | [[`copy_cv<int const, void>::type`][`int const`]] |
| 29 | |
| 30 | [[`copy_cv<int, void const>::type`][`int const`]] |
| 31 | |
| 32 | [[`copy_cv<int volatile, void const>::type`][`int const volatile`]] |
| 33 | |
| 34 | [[`copy_cv<int&, void const>::type`] [`int&`]] |
| 35 | |
| 36 | [[`copy_cv<int*, void volatile>::type`] [`int* volatile`]] |
| 37 | |
| 38 | ] |
| 39 | |
| 40 | [endsect] |
| 41 | |