1#ifndef BOOST_TYPE_TRAITS_COPY_CV_HPP_INCLUDED
2#define BOOST_TYPE_TRAITS_COPY_CV_HPP_INCLUDED
3
4//
5// Copyright 2015 Peter Dimov
6//
7// Distributed under the Boost Software License, Version 1.0.
8// See accompanying file LICENSE_1_0.txt or copy at
9// http://www.boost.org/LICENSE_1_0.txt
10//
11
12#include <boost/type_traits/is_const.hpp>
13#include <boost/type_traits/is_volatile.hpp>
14#include <boost/type_traits/add_const.hpp>
15#include <boost/type_traits/add_volatile.hpp>
16#include <boost/type_traits/conditional.hpp>
17
18namespace boost
19{
20
21template<class T, class U> struct copy_cv
22{
23private:
24
25 typedef typename boost::conditional<boost::is_const<U>::value, typename boost::add_const<T>::type, T>::type CT;
26
27public:
28
29 typedef typename boost::conditional<boost::is_volatile<U>::value, typename boost::add_volatile<CT>::type, CT>::type type;
30};
31
32#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
33
34 template <class T, class U> using copy_cv_t = typename copy_cv<T, U>::type;
35
36#endif
37
38} // namespace boost
39
40#endif // #ifndef BOOST_TYPE_TRAITS_COPY_CV_HPP_INCLUDED
41

source code of include/boost/type_traits/copy_cv.hpp