mp_rename.hpp 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #ifndef BOOST_MP11_DETAIL_MP_RENAME_HPP_INCLUDED
  2. #define BOOST_MP11_DETAIL_MP_RENAME_HPP_INCLUDED
  3. // Copyright 2015-2021 Peter Dimov.
  4. //
  5. // Distributed under the Boost Software License, Version 1.0.
  6. //
  7. // See accompanying file LICENSE_1_0.txt or copy at
  8. // http://www.boost.org/LICENSE_1_0.txt
  9. namespace boost
  10. {
  11. namespace mp11
  12. {
  13. // mp_rename<L, B>
  14. namespace detail
  15. {
  16. template<class A, template<class...> class B> struct mp_rename_impl
  17. {
  18. // An error "no type named 'type'" here means that the first argument to mp_rename is not a list
  19. };
  20. template<template<class...> class A, class... T, template<class...> class B> struct mp_rename_impl<A<T...>, B>
  21. {
  22. using type = B<T...>;
  23. };
  24. } // namespace detail
  25. template<class A, template<class...> class B> using mp_rename = typename detail::mp_rename_impl<A, B>::type;
  26. template<template<class...> class F, class L> using mp_apply = typename detail::mp_rename_impl<L, F>::type;
  27. template<class Q, class L> using mp_apply_q = typename detail::mp_rename_impl<L, Q::template fn>::type;
  28. } // namespace mp11
  29. } // namespace boost
  30. #endif // #ifndef BOOST_MP11_DETAIL_MP_RENAME_HPP_INCLUDED