1 #ifndef BOOST_MP11_DETAIL_MPL_COMMON_HPP_INCLUDED
2 #define BOOST_MP11_DETAIL_MPL_COMMON_HPP_INCLUDED
4 // Copyright 2017, 2019 Peter Dimov.
6 // Distributed under the Boost Software License, Version 1.0.
8 // See accompanying file LICENSE_1_0.txt or copy at
9 // http://www.boost.org/LICENSE_1_0.txt
11 #include <boost/mp11/list.hpp>
12 #include <boost/mp11/algorithm.hpp>
19 struct forward_iterator_tag;
26 template<class L> struct mp11_iterator
28 using category = forward_iterator_tag;
30 using type = mp11::mp_first<L>;
31 using next = mp11_iterator<mp11::mp_rest<L>>;
38 template< typename Tag > struct at_impl;
40 template<> struct at_impl<aux::mp11_tag>
42 template<class L, class I> struct apply
44 using type = mp11::mp_at<L, I>;
50 template< typename Tag > struct back_impl;
52 template<> struct back_impl<aux::mp11_tag>
54 template<class L> struct apply
56 using N = mp11::mp_size<L>;
57 using type = mp11::mp_at_c<L, N::value - 1>;
63 template< typename Tag > struct begin_impl;
65 template<> struct begin_impl<aux::mp11_tag>
67 template<class L> struct apply
69 using type = aux::mp11_iterator<L>;
75 template< typename Tag > struct clear_impl;
77 template<> struct clear_impl<aux::mp11_tag>
79 template<class L> struct apply
81 using type = mp11::mp_clear<L>;
87 template< typename Tag > struct end_impl;
89 template<> struct end_impl<aux::mp11_tag>
91 template<class L> struct apply
93 using type = aux::mp11_iterator<mp11::mp_clear<L>>;
99 template< typename Tag > struct front_impl;
101 template<> struct front_impl<aux::mp11_tag>
103 template<class L> struct apply
105 using type = mp11::mp_front<L>;
111 template< typename Tag > struct pop_front_impl;
113 template<> struct pop_front_impl<aux::mp11_tag>
115 template<class L> struct apply
117 using type = mp11::mp_pop_front<L>;
123 template< typename Tag > struct push_back_impl;
125 template<> struct push_back_impl<aux::mp11_tag>
127 template<class L, class T> struct apply
129 using type = mp11::mp_push_back<L, T>;
135 template< typename Tag > struct push_front_impl;
137 template<> struct push_front_impl<aux::mp11_tag>
139 template<class L, class T> struct apply
141 using type = mp11::mp_push_front<L, T>;
147 template< typename Tag > struct size_impl;
149 template<> struct size_impl<aux::mp11_tag>
151 template<class L> struct apply
153 using type = mp11::mp_size<L>;
160 #endif // #ifndef BOOST_MP11_DETAIL_MPL_COMMON_HPP_INCLUDED