copy_cv.hpp 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. * Copyright Andrey Semashev 2007 - 2015.
  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. * \file copy_cv.hpp
  9. * \author Andrey Semashev
  10. * \date 16.03.2014
  11. *
  12. * The header defines \c copy_cv type trait which copies const/volatile qualifiers from one type to another
  13. */
  14. #ifndef BOOST_LOG_DETAIL_COPY_CV_HPP_INCLUDED_
  15. #define BOOST_LOG_DETAIL_COPY_CV_HPP_INCLUDED_
  16. #include <boost/log/detail/config.hpp>
  17. #include <boost/log/detail/header.hpp>
  18. #ifdef BOOST_HAS_PRAGMA_ONCE
  19. #pragma once
  20. #endif
  21. namespace boost {
  22. BOOST_LOG_OPEN_NAMESPACE
  23. namespace aux {
  24. //! The type trait copies top level const/volatile qualifiers from \c FromT to \c ToT
  25. template< typename FromT, typename ToT >
  26. struct copy_cv
  27. {
  28. typedef ToT type;
  29. };
  30. template< typename FromT, typename ToT >
  31. struct copy_cv< const FromT, ToT >
  32. {
  33. typedef const ToT type;
  34. };
  35. template< typename FromT, typename ToT >
  36. struct copy_cv< volatile FromT, ToT >
  37. {
  38. typedef volatile ToT type;
  39. };
  40. template< typename FromT, typename ToT >
  41. struct copy_cv< const volatile FromT, ToT >
  42. {
  43. typedef const volatile ToT type;
  44. };
  45. } // namespace aux
  46. BOOST_LOG_CLOSE_NAMESPACE // namespace log
  47. } // namespace boost
  48. #include <boost/log/detail/footer.hpp>
  49. #endif // BOOST_LOG_DETAIL_COPY_CV_HPP_INCLUDED_