summaryrefslogtreecommitdiff
path: root/boost/type_traits/copy_cv.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/type_traits/copy_cv.hpp')
-rw-r--r--boost/type_traits/copy_cv.hpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/boost/type_traits/copy_cv.hpp b/boost/type_traits/copy_cv.hpp
new file mode 100644
index 0000000000..1605ca3356
--- /dev/null
+++ b/boost/type_traits/copy_cv.hpp
@@ -0,0 +1,34 @@
+#ifndef BOOST_TYPE_TRAITS_COPY_CV_HPP_INCLUDED
+#define BOOST_TYPE_TRAITS_COPY_CV_HPP_INCLUDED
+
+//
+// Copyright 2015 Peter Dimov
+//
+// Distributed under the Boost Software License, Version 1.0.
+// See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt
+//
+
+#include <boost/type_traits/is_const.hpp>
+#include <boost/type_traits/is_volatile.hpp>
+#include <boost/type_traits/add_const.hpp>
+#include <boost/type_traits/add_volatile.hpp>
+#include <boost/type_traits/conditional.hpp>
+
+namespace boost
+{
+
+template<class T, class U> struct copy_cv
+{
+private:
+
+ typedef typename boost::conditional<boost::is_const<U>::value, typename boost::add_const<T>::type, T>::type CT;
+
+public:
+
+ typedef typename boost::conditional<boost::is_volatile<U>::value, typename boost::add_volatile<CT>::type, CT>::type type;
+};
+
+} // namespace boost
+
+#endif // #ifndef BOOST_TYPE_TRAITS_COPY_CV_HPP_INCLUDED