1#ifndef BOOST_MP11_DETAIL_MP_RENAME_HPP_INCLUDED
2#define BOOST_MP11_DETAIL_MP_RENAME_HPP_INCLUDED
3
4// Copyright 2015-2023 Peter Dimov.
5//
6// Distributed under the Boost Software License, Version 1.0.
7//
8// See accompanying file LICENSE_1_0.txt or copy at
9// http://www.boost.org/LICENSE_1_0.txt
10
11#include <boost/mp11/detail/mp_defer.hpp>
12#include <boost/mp11/detail/mp_value.hpp>
13#include <boost/mp11/detail/config.hpp>
14
15namespace boost
16{
17namespace mp11
18{
19
20// mp_rename<L, B>
21namespace detail
22{
23
24template<class L, template<class...> class B> struct mp_rename_impl
25{
26// An error "no type named 'type'" here means that the first argument to mp_rename is not a list
27};
28
29template<template<class...> class L, class... T, template<class...> class B> struct mp_rename_impl<L<T...>, B>: mp_defer<B, T...>
30{
31};
32
33#if defined(BOOST_MP11_HAS_TEMPLATE_AUTO)
34
35template<template<auto...> class L, auto... A, template<class...> class B> struct mp_rename_impl<L<A...>, B>: mp_defer<B, mp_value<A>...>
36{
37};
38
39#endif
40
41} // namespace detail
42
43template<class L, template<class...> class B> using mp_rename = typename detail::mp_rename_impl<L, B>::type;
44
45// mp_apply<F, L>
46template<template<class...> class F, class L> using mp_apply = typename detail::mp_rename_impl<L, F>::type;
47
48// mp_apply_q<Q, L>
49template<class Q, class L> using mp_apply_q = typename detail::mp_rename_impl<L, Q::template fn>::type;
50
51} // namespace mp11
52} // namespace boost
53
54#endif // #ifndef BOOST_MP11_DETAIL_MP_RENAME_HPP_INCLUDED
55