#ifndef BOOST_MP11_LIST_HPP_INCLUDED #define BOOST_MP11_LIST_HPP_INCLUDED // Copyright 2015-2017 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 namespace boost { namespace mp11 { // mp_list_c template using mp_list_c = mp_list...>; // mp_is_list // in detail/mp_is_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; }; } // 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; template class L1, class... T, template class L2, class... U> struct mp_assign_impl, L2> { using type = L1; }; } // namespace detail template using mp_assign = typename detail::mp_assign_impl::type; // mp_clear template using mp_clear = mp_assign>; // mp_front namespace detail { template struct mp_front_impl { // An error "no type named 'type'" here means that the argument to mp_front // is either not a list, or is an empty list }; template class L, class T1, class... T> struct mp_front_impl> { using type = T1; }; } // namespace detail template using mp_front = typename detail::mp_front_impl::type; // 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; }; } // 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; }; } // 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; }; } // 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; }; } // 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; }; } // namespace detail template using mp_push_back = typename detail::mp_push_back_impl::type; // mp_rename namespace detail { template class B> struct mp_rename_impl { // An error "no type named 'type'" here means that the first argument to mp_rename is not a list }; template class A, class... T, template class B> struct mp_rename_impl, B> { using type = B; }; } // namespace detail template class B> using mp_rename = typename detail::mp_rename_impl::type; template class F, class L> using mp_apply = typename detail::mp_rename_impl::type; template using mp_apply_q = typename detail::mp_rename_impl::type; // 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; }; } // 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; }; } // 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; }; } // 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...>; }; } // 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...>; }; } // 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...>; }; } // 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 #endif // #ifndef BOOST_MP11_LIST_HPP_INCLUDED