Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:40:55

0001 #ifndef BOOST_MP11_DETAIL_MPL_COMMON_HPP_INCLUDED
0002 #define BOOST_MP11_DETAIL_MPL_COMMON_HPP_INCLUDED
0003 
0004 // Copyright 2017, 2019 Peter Dimov.
0005 //
0006 // Distributed under the Boost Software License, Version 1.0.
0007 //
0008 // See accompanying file LICENSE_1_0.txt or copy at
0009 // http://www.boost.org/LICENSE_1_0.txt
0010 
0011 #include <boost/mp11/list.hpp>
0012 #include <boost/mp11/algorithm.hpp>
0013 
0014 namespace boost
0015 {
0016 namespace mpl
0017 {
0018 
0019 struct forward_iterator_tag;
0020 
0021 namespace aux
0022 {
0023 
0024 struct mp11_tag {};
0025 
0026 template<class L> struct mp11_iterator
0027 {
0028     using category = forward_iterator_tag;
0029 
0030     using type = mp11::mp_first<L>;
0031     using next = mp11_iterator<mp11::mp_rest<L>>;
0032 };
0033 
0034 } // namespace aux
0035 
0036 // at
0037 
0038 template< typename Tag > struct at_impl;
0039 
0040 template<> struct at_impl<aux::mp11_tag>
0041 {
0042     template<class L, class I> struct apply
0043     {
0044         using type = mp11::mp_at<L, I>;
0045     };
0046 };
0047 
0048 // back
0049 
0050 template< typename Tag > struct back_impl;
0051 
0052 template<> struct back_impl<aux::mp11_tag>
0053 {
0054     template<class L> struct apply
0055     {
0056         using N = mp11::mp_size<L>;
0057         using type = mp11::mp_at_c<L, N::value - 1>;
0058     };
0059 };
0060 
0061 // begin
0062 
0063 template< typename Tag > struct begin_impl;
0064 
0065 template<> struct begin_impl<aux::mp11_tag>
0066 {
0067     template<class L> struct apply
0068     {
0069         using type = aux::mp11_iterator<L>;
0070     };
0071 };
0072 
0073 // clear
0074 
0075 template< typename Tag > struct clear_impl;
0076 
0077 template<> struct clear_impl<aux::mp11_tag>
0078 {
0079     template<class L> struct apply
0080     {
0081         using type = mp11::mp_clear<L>;
0082     };
0083 };
0084 
0085 // end
0086 
0087 template< typename Tag > struct end_impl;
0088 
0089 template<> struct end_impl<aux::mp11_tag>
0090 {
0091     template<class L> struct apply
0092     {
0093         using type = aux::mp11_iterator<mp11::mp_clear<L>>;
0094     };
0095 };
0096 
0097 // front
0098 
0099 template< typename Tag > struct front_impl;
0100 
0101 template<> struct front_impl<aux::mp11_tag>
0102 {
0103     template<class L> struct apply
0104     {
0105         using type = mp11::mp_front<L>;
0106     };
0107 };
0108 
0109 // pop_front
0110 
0111 template< typename Tag > struct pop_front_impl;
0112 
0113 template<> struct pop_front_impl<aux::mp11_tag>
0114 {
0115     template<class L> struct apply
0116     {
0117         using type = mp11::mp_pop_front<L>;
0118     };
0119 };
0120 
0121 // push_back
0122 
0123 template< typename Tag > struct push_back_impl;
0124 
0125 template<> struct push_back_impl<aux::mp11_tag>
0126 {
0127     template<class L, class T> struct apply
0128     {
0129         using type = mp11::mp_push_back<L, T>;
0130     };
0131 };
0132 
0133 // push_front
0134 
0135 template< typename Tag > struct push_front_impl;
0136 
0137 template<> struct push_front_impl<aux::mp11_tag>
0138 {
0139     template<class L, class T> struct apply
0140     {
0141         using type = mp11::mp_push_front<L, T>;
0142     };
0143 };
0144 
0145 // size
0146 
0147 template< typename Tag > struct size_impl;
0148 
0149 template<> struct size_impl<aux::mp11_tag>
0150 {
0151     template<class L> struct apply
0152     {
0153         using type = mp11::mp_size<L>;
0154     };
0155 };
0156 
0157 } // namespace mpl
0158 } // namespace boost
0159 
0160 #endif // #ifndef BOOST_MP11_DETAIL_MPL_COMMON_HPP_INCLUDED