#ifndef BOOST_MP11_LIST_HPP_INCLUDED #define BOOST_MP11_LIST_HPP_INCLUDED // Copyright 2015-2023 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 #include #include #include #include #include #include #include #include #include #if defined(_MSC_VER) || defined(__GNUC__) # pragma push_macro( "I" ) # undef I #endif namespace boost { namespace mp11 { // mp_list // in detail/mp_list.hpp // mp_list_c template using mp_list_c = mp_list...>; // mp_list_v // in detail/mp_list_v.hpp // mp_is_list // in detail/mp_is_list.hpp // mp_is_value_list // in detail/mp_is_value_list.hpp // mp_size namespace detail { template struct mp_size_impl { // An error "no type named 'type'" here means that the argument to mp_size is not a list }; template class L, class... T> struct mp_size_impl> { using type = mp_size_t; }; #if defined(BOOST_MP11_HAS_TEMPLATE_AUTO) template class L, auto... A> struct mp_size_impl> { using type = mp_size_t; }; #endif } // namespace detail template using mp_size = typename detail::mp_size_impl::type; // mp_empty template using mp_empty = mp_bool< mp_size::value == 0 >; // mp_assign namespace detail { template struct mp_assign_impl { // An error "no type named 'type'" here means that the arguments to mp_assign aren't lists }; template class L1, class... T, template class L2, class... U> struct mp_assign_impl, L2> { using type = L1; }; #if defined(BOOST_MP11_HAS_TEMPLATE_AUTO) template class L1, auto... A, template class L2, class... U> struct mp_assign_impl, L2> { using type = L1; }; template class L1, class... T, template class L2, auto... B> struct mp_assign_impl, L2> { using type = L1...>; }; template class L1, auto... A, template class L2, auto... B> struct mp_assign_impl, L2> { using type = L1; }; #endif } // namespace detail template using mp_assign = typename detail::mp_assign_impl::type; // mp_clear template using mp_clear = mp_assign>; // mp_front // in detail/mp_front.hpp // mp_pop_front namespace detail { template struct mp_pop_front_impl { // An error "no type named 'type'" here means that the argument to mp_pop_front // is either not a list, or is an empty list }; template class L, class T1, class... T> struct mp_pop_front_impl> { using type = L; }; #if defined(BOOST_MP11_HAS_TEMPLATE_AUTO) template class L, auto A1, auto... A> struct mp_pop_front_impl> { using type = L; }; #endif } // namespace detail template using mp_pop_front = typename detail::mp_pop_front_impl::type; // mp_first template using mp_first = mp_front; // mp_rest template using mp_rest = mp_pop_front; // mp_second namespace detail { template struct mp_second_impl { // An error "no type named 'type'" here means that the argument to mp_second // is either not a list, or has fewer than two elements }; template class L, class T1, class T2, class... T> struct mp_second_impl> { using type = T2; }; #if defined(BOOST_MP11_HAS_TEMPLATE_AUTO) template class L, auto A1, auto A2, auto... A> struct mp_second_impl> { using type = mp_value; }; #endif } // namespace detail template using mp_second = typename detail::mp_second_impl::type; // mp_third namespace detail { template struct mp_third_impl { // An error "no type named 'type'" here means that the argument to mp_third // is either not a list, or has fewer than three elements }; template class L, class T1, class T2, class T3, class... T> struct mp_third_impl> { using type = T3; }; #if defined(BOOST_MP11_HAS_TEMPLATE_AUTO) template class L, auto A1, auto A2, auto A3, auto... A> struct mp_third_impl> { using type = mp_value; }; #endif } // namespace detail template using mp_third = typename detail::mp_third_impl::type; // mp_push_front namespace detail { template struct mp_push_front_impl { // An error "no type named 'type'" here means that the first argument to mp_push_front is not a list }; template class L, class... U, class... T> struct mp_push_front_impl, T...> { using type = L; }; #if defined(BOOST_MP11_HAS_TEMPLATE_AUTO) template class L, auto... A, class... T> struct mp_push_front_impl, T...> { using type = L; }; #endif } // namespace detail template using mp_push_front = typename detail::mp_push_front_impl::type; // mp_push_back namespace detail { template struct mp_push_back_impl { // An error "no type named 'type'" here means that the first argument to mp_push_back is not a list }; template class L, class... U, class... T> struct mp_push_back_impl, T...> { using type = L; }; #if defined(BOOST_MP11_HAS_TEMPLATE_AUTO) template class L, auto... A, class... T> struct mp_push_back_impl, T...> { using type = L; }; #endif } // namespace detail template using mp_push_back = typename detail::mp_push_back_impl::type; // mp_rename // mp_apply // mp_apply_q // in detail/mp_rename.hpp // mp_rename_v #if defined(BOOST_MP11_HAS_TEMPLATE_AUTO) namespace detail { template class B> struct mp_rename_v_impl { // An error "no type named 'type'" here means that the first argument to mp_rename_v is not a list }; template class L, class... T, template class B> struct mp_rename_v_impl, B> { using type = B; }; template class L, auto... A, template class B> struct mp_rename_v_impl, B> { using type = B; }; } // namespace detail template class B> using mp_rename_v = typename detail::mp_rename_v_impl::type; #endif // mp_replace_front namespace detail { template struct mp_replace_front_impl { // An error "no type named 'type'" here means that the first argument to mp_replace_front // is either not a list, or is an empty list }; template class L, class U1, class... U, class T> struct mp_replace_front_impl, T> { using type = L; }; #if defined(BOOST_MP11_HAS_TEMPLATE_AUTO) template class L, auto A1, auto... A, class T> struct mp_replace_front_impl, T> { using type = L; }; #endif } // namespace detail template using mp_replace_front = typename detail::mp_replace_front_impl::type; // mp_replace_first template using mp_replace_first = typename detail::mp_replace_front_impl::type; // mp_replace_second namespace detail { template struct mp_replace_second_impl { // An error "no type named 'type'" here means that the first argument to mp_replace_second // is either not a list, or has fewer than two elements }; template class L, class U1, class U2, class... U, class T> struct mp_replace_second_impl, T> { using type = L; }; #if defined(BOOST_MP11_HAS_TEMPLATE_AUTO) template class L, auto A1, auto A2, auto... A, class T> struct mp_replace_second_impl, T> { using type = L; }; #endif } // namespace detail template using mp_replace_second = typename detail::mp_replace_second_impl::type; // mp_replace_third namespace detail { template struct mp_replace_third_impl { // An error "no type named 'type'" here means that the first argument to mp_replace_third // is either not a list, or has fewer than three elements }; template class L, class U1, class U2, class U3, class... U, class T> struct mp_replace_third_impl, T> { using type = L; }; #if defined(BOOST_MP11_HAS_TEMPLATE_AUTO) template class L, auto A1, auto A2, auto A3, auto... A, class T> struct mp_replace_third_impl, T> { using type = L; }; #endif } // namespace detail template using mp_replace_third = typename detail::mp_replace_third_impl::type; // mp_transform_front namespace detail { template class F> struct mp_transform_front_impl { // An error "no type named 'type'" here means that the first argument to mp_transform_front // is either not a list, or is an empty list }; template class L, class U1, class... U, template class F> struct mp_transform_front_impl, F> { using type = L, U...>; }; #if defined(BOOST_MP11_HAS_TEMPLATE_AUTO) template class L, auto A1, auto... A, template class F> struct mp_transform_front_impl, F> { using type = L>::value, A...>; }; #endif } // namespace detail template class F> using mp_transform_front = typename detail::mp_transform_front_impl::type; template using mp_transform_front_q = mp_transform_front; // mp_transform_first template class F> using mp_transform_first = typename detail::mp_transform_front_impl::type; template using mp_transform_first_q = mp_transform_first; // mp_transform_second namespace detail { template class F> struct mp_transform_second_impl { // An error "no type named 'type'" here means that the first argument to mp_transform_second // is either not a list, or has fewer than two elements }; template class L, class U1, class U2, class... U, template class F> struct mp_transform_second_impl, F> { using type = L, U...>; }; #if defined(BOOST_MP11_HAS_TEMPLATE_AUTO) template class L, auto A1, auto A2, auto... A, template class F> struct mp_transform_second_impl, F> { using type = L>::value, A...>; }; #endif } // namespace detail template class F> using mp_transform_second = typename detail::mp_transform_second_impl::type; template using mp_transform_second_q = mp_transform_second; // mp_transform_third namespace detail { template class F> struct mp_transform_third_impl { // An error "no type named 'type'" here means that the first argument to mp_transform_third // is either not a list, or has fewer than three elements }; template class L, class U1, class U2, class U3, class... U, template class F> struct mp_transform_third_impl, F> { using type = L, U...>; }; #if defined(BOOST_MP11_HAS_TEMPLATE_AUTO) template class L, auto A1, auto A2, auto A3, auto... A, template class F> struct mp_transform_third_impl, F> { using type = L>::value, A...>; }; #endif } // namespace detail template class F> using mp_transform_third = typename detail::mp_transform_third_impl::type; template using mp_transform_third_q = mp_transform_third; } // namespace mp11 } // namespace boost #if defined(_MSC_VER) || defined(__GNUC__) # pragma pop_macro( "I" ) #endif #endif // #ifndef BOOST_MP11_LIST_HPP_INCLUDED