diff --git a/include/boost/mpl/aux_/partition_op.hpp b/include/boost/mpl/aux_/partition_op.hpp index 00b4cbc..9a0911c 100644 --- a/include/boost/mpl/aux_/partition_op.hpp +++ b/include/boost/mpl/aux_/partition_op.hpp @@ -3,6 +3,7 @@ #define BOOST_MPL_AUX_PARTITION_OP_HPP_INCLUDED // Copyright Eric Friedman 2003 +// Copyright Aleksey Gurtovoy 2004 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -18,33 +19,28 @@ #include #include #include -#include -#include #include namespace boost { namespace mpl { namespace aux { -template +template< typename Pred, typename In1Op, typename In2Op > struct partition_op { - template + template< typename State, typename T > struct apply { - private: typedef typename State::first first_; typedef typename State::second second_; - typedef typename deref::type t_; - typedef typename apply1< Predicate,t_ >::type pred_; + typedef typename apply1< Pred,T >::type pred_; typedef typename eval_if< pred_ - , push_front< first_, t_ > - , push_front< second_, t_ > + , apply2 + , apply2 >::type result_; - public: typedef typename if_< pred_ , pair< result_,second_ > @@ -55,7 +51,7 @@ struct partition_op } // namespace aux -BOOST_MPL_AUX_PASS_THROUGH_LAMBDA_SPEC(1,aux::partition_op) +BOOST_MPL_AUX_PASS_THROUGH_LAMBDA_SPEC(3, aux::partition_op) }} diff --git a/include/boost/mpl/aux_/sequence_wrapper.hpp b/include/boost/mpl/aux_/sequence_wrapper.hpp index f1b4b5c..ff13f30 100644 --- a/include/boost/mpl/aux_/sequence_wrapper.hpp +++ b/include/boost/mpl/aux_/sequence_wrapper.hpp @@ -36,6 +36,10 @@ namespace boost { namespace mpl { +#if !defined(AUX778076_SEQUENCE_BASE_NAME) +# define AUX778076_SEQUENCE_BASE_NAME AUX778076_SEQUENCE_NAME +#endif + #if !defined(AUX778076_SEQUENCE_INTEGRAL_WRAPPER) # define AUX778076_SEQUENCE_PARAM_NAME T @@ -43,7 +47,7 @@ namespace boost { namespace mpl { # define AUX778076_SEQUENCE_DEFAULT na # define AUX778076_SEQUENCE_NAME_N(n) \ - BOOST_PP_CAT(AUX778076_SEQUENCE_NAME,n) \ + BOOST_PP_CAT(AUX778076_SEQUENCE_BASE_NAME,n) \ /**/ # define AUX778076_SEQUENCE_PARAMS() \ @@ -209,6 +213,7 @@ struct AUX778076_SEQUENCE_NAME # undef AUX778076_SEQUENCE_TEMPLATE_PARAM # undef AUX778076_SEQUENCE_PARAM_NAME # undef AUX778076_SEQUENCE_LIMIT +# undef AUX778076_SEQUENCE_BASE_NAME # undef AUX778076_SEQUENCE_NAME # undef AUX778076_SEQUENCE_INTEGRAL_WRAPPER diff --git a/include/boost/mpl/aux_/single_element_iter.hpp b/include/boost/mpl/aux_/single_element_iter.hpp index 6ecd7cd..13263d3 100644 --- a/include/boost/mpl/aux_/single_element_iter.hpp +++ b/include/boost/mpl/aux_/single_element_iter.hpp @@ -15,104 +15,104 @@ // $Revision$ #include -#include -#include +#include +#include +#include +#include #include -#include -#include -#include -#include #include +#include +#include namespace boost { namespace mpl { -namespace aux { - -template< typename T, int N > -struct single_element_iter; - -// random access support -template< typename T, BOOST_MPL_AUX_NTTP_DECL(int, N) > -struct single_iter_base -{ - typedef random_access_iterator_tag category; - typedef mpl::int_ position; - - template< typename D > - struct BOOST_MPL_AUX_ITERATOR_ADVANCE - { - typedef plus< mpl::int_,D > n_; - typedef single_element_iter< - T - , BOOST_MPL_AUX_VALUE_WKND(n_)::value - > type; - }; - - template< typename U > - struct BOOST_MPL_AUX_ITERATOR_DISTANCE - { - typedef typename minus< - typename U::position - , mpl::int_ - >::type type; - }; -}; - #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) +namespace aux { + +template< typename T, BOOST_MPL_AUX_NTTP_DECL(int, is_last_) > +struct sel_iter; + template< typename T > -struct single_element_iter - : single_iter_base +struct sel_iter { - typedef single_element_iter next; + typedef random_access_iterator_tag category; + typedef sel_iter next; typedef T type; }; template< typename T > -struct single_element_iter - : single_iter_base +struct sel_iter +{ + typedef random_access_iterator_tag category; + typedef sel_iter prior; +}; + +} // namespace aux + +template< typename T, BOOST_MPL_AUX_NTTP_DECL(int, is_last_), typename Distance > +struct advance< aux::sel_iter,Distance> +{ + typedef aux::sel_iter< + T + , ( is_last_ + BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Distance) ) + > type; +}; + +template< + typename T + , BOOST_MPL_AUX_NTTP_DECL(int, l1) + , BOOST_MPL_AUX_NTTP_DECL(int, l2) + > +struct distance< aux::sel_iter, aux::sel_iter > + : int_<( l2 - l1 )> { - typedef single_element_iter prior; }; #else -template< BOOST_MPL_AUX_NTTP_DECL(int, N) > struct single_iter_impl +namespace aux { + +struct sel_iter_tag; + +template< typename T, BOOST_MPL_AUX_NTTP_DECL(int, is_last_) > +struct sel_iter { - template< typename T > struct result_; + enum { pos_ = is_last_ }; + typedef aux::sel_iter_tag tag; + typedef random_access_iterator_tag category; + + typedef sel_iter next; + typedef sel_iter prior; + typedef T type; }; -template<> -struct single_iter_impl<0> +} // namespace aux + +template<> struct advance_impl { - template< typename T > struct result_ - : single_iter_base + template< typename Iterator, typename N > struct apply { - typedef single_element_iter next; - typedef T type; + enum { pos_ = Iterator::pos_, n_ = N::value }; + typedef aux::sel_iter< + typename Iterator::type + , (pos_ + n_) + > type; }; }; -template<> -struct single_iter_impl<1> +template<> struct distance_impl { - template< typename T > struct result_ - : single_iter_base + template< typename Iter1, typename Iter2 > struct apply { - typedef single_element_iter prior; + enum { pos1_ = Iter1::pos_, pos2_ = Iter2::pos_ }; + typedef int_<( pos2_ - pos1_ )> type; + BOOST_STATIC_CONSTANT(int, value = ( pos2_ - pos1_ )); }; }; -template< typename T, BOOST_MPL_AUX_NTTP_DECL(int, N) > -struct single_element_iter - : single_iter_impl::template result_ -{ -}; - #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION -} // namespace aux - }} #endif // BOOST_MPL_AUX_SINGLE_ELEMENT_ITER_HPP_INCLUDED diff --git a/include/boost/mpl/aux_/sort_impl.hpp b/include/boost/mpl/aux_/sort_impl.hpp index b645241..40c5433 100644 --- a/include/boost/mpl/aux_/sort_impl.hpp +++ b/include/boost/mpl/aux_/sort_impl.hpp @@ -14,91 +14,108 @@ // $Date$ // $Revision$ -#include -#include -#include -#include -#include -#include #include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include -namespace boost { namespace mpl { +namespace boost { namespace mpl { namespace aux { -namespace aux { +template< typename Seq, typename Pred > +struct quick_sort; -template < typename Sequence, typename Predicate > struct quick_sort; - -template +// agurt, 10/nov/04: for the sake of deficeint compilers +template< typename Pred, typename Pivot > struct quick_sort_pred { - template - struct apply + template< typename T > struct apply { - typedef typename apply2< Predicate, T, Pivot >::type - type; + typedef typename apply2::type type; }; }; -template +template< + typename Seq + , typename Pred + > struct quick_sort_impl { -private: - - typedef typename front::type pivot_; - typedef typename pop_front::type seq_; - + typedef typename begin::type pivot; typedef typename partition< - seq_ - , protect< quick_sort_pred > + iterator_range< + typename next::type + , typename end::type + > + , protect< aux::quick_sort_pred< Pred, typename deref::type > > + , back_inserter< vector<> > + , back_inserter< vector<> > >::type partitioned; - typedef typename quick_sort< - typename first::type, Predicate - >::type first_part; - typedef typename quick_sort< - typename second::type, Predicate - >::type second_part; - -public: - - typedef typename reverse_fold< - first_part - , typename push_front< second_part,pivot_ >::type - , push_front<_,_> - >::type type; + typedef typename quick_sort< typename partitioned::first, Pred >::type part1; + typedef typename quick_sort< typename partitioned::second, Pred >::type part2; + typedef joint_view< + joint_view< part1, single_view< typename deref::type > > + , part2 + > type; }; -template +template< + typename Seq + , typename Pred + > struct quick_sort : eval_if< - empty - , identity< Sequence > - , quick_sort_impl< Sequence,Predicate > + empty + , identity + , quick_sort_impl > { }; -} // namespace aux -template< typename Tag > +template < + typename Sequence + , typename Pred + , typename In + > struct sort_impl { - template< typename Sequence, typename Predicate > - struct apply - { - typedef typename aux::quick_sort< - Sequence, Predicate - >::type type; - }; + typedef typename quick_sort< + Sequence + , typename if_na >::type + >::type result_; + + typedef typename copy::type type; }; -BOOST_MPL_ALGORITM_TRAITS_LAMBDA_SPEC(2,sort_impl) +template < + typename Sequence + , typename Pred + , typename In + > +struct reverse_sort_impl +{ + typedef typename quick_sort< + Sequence + , typename if_na >::type + >::type result_; + + typedef typename reverse_copy::type type; +}; -}} +}}} #endif // BOOST_MPL_AUX_SORT_IMPL_HPP_INCLUDED diff --git a/include/boost/mpl/deque.hpp b/include/boost/mpl/deque.hpp new file mode 100644 index 0000000..3a7153c --- /dev/null +++ b/include/boost/mpl/deque.hpp @@ -0,0 +1,58 @@ + +#ifndef BOOST_MPL_DEQUE_HPP_INCLUDED +#define BOOST_MPL_DEQUE_HPP_INCLUDED + +// Copyright Aleksey Gurtovoy 2000-2004 +// +// 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) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Source$ +// $Date$ +// $Revision$ + +#if !defined(BOOST_MPL_PREPROCESSING_MODE) +# include +# include +# include + +# include +# include +# include + +#if !defined(BOOST_NEEDS_TOKEN_PASTING_OP_FOR_TOKENS_JUXTAPOSING) +# define AUX778076_DEQUE_HEADER \ + BOOST_PP_CAT(vector, BOOST_MPL_LIMIT_VECTOR_SIZE).hpp \ + /**/ +#else +# define AUX778076_DEQUE_HEADER \ + BOOST_PP_CAT(vector, BOOST_MPL_LIMIT_VECTOR_SIZE)##.hpp \ + /**/ +#endif + +# include BOOST_PP_STRINGIZE(boost/mpl/vector/AUX778076_DEQUE_HEADER) +# undef AUX778076_DEQUE_HEADER +#endif + +#include + +#if !defined(BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS) \ + && !defined(BOOST_MPL_PREPROCESSING_MODE) + +# define BOOST_MPL_PREPROCESSED_HEADER deque.hpp +# include + +#else + +# include + +# define AUX778076_SEQUENCE_NAME deque +# define AUX778076_SEQUENCE_BASE_NAME vector +# define AUX778076_SEQUENCE_LIMIT BOOST_MPL_LIMIT_VECTOR_SIZE +# include + +#endif // BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS +#endif // BOOST_MPL_DEQUE_HPP_INCLUDED diff --git a/include/boost/mpl/distance_fwd.hpp b/include/boost/mpl/distance_fwd.hpp index 66152cc..af80283 100644 --- a/include/boost/mpl/distance_fwd.hpp +++ b/include/boost/mpl/distance_fwd.hpp @@ -20,7 +20,7 @@ namespace boost { namespace mpl { BOOST_MPL_AUX_COMMON_NAME_WKND(distance) -template< typename Tag > struct advance_impl; +template< typename Tag > struct distance_impl; template< typename First, typename Last > struct distance; }} diff --git a/include/boost/mpl/empty_sequence.hpp b/include/boost/mpl/empty_sequence.hpp new file mode 100644 index 0000000..be4113b --- /dev/null +++ b/include/boost/mpl/empty_sequence.hpp @@ -0,0 +1,42 @@ + +#ifndef BOOST_MPL_EMPTY_SEQUENCE_HPP_INCLUDED +#define BOOST_MPL_EMPTY_SEQUENCE_HPP_INCLUDED + +// Copyright Aleksey Gurtovoy 2004 +// Copyright Alexander Nasonov 2004 +// +// 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) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Source$ +// $Date$ +// $Revision$ + +#include +#include +#include + +namespace boost { namespace mpl { + +struct empty_sequence +{ + struct tag; + struct begin { typedef random_access_iterator_tag category; }; + typedef begin end; +}; + +template<> +struct size_impl +{ + template< typename Sequence > struct apply + : int_<0> + { + }; +}; + +}} + +#endif // #ifndef BOOST_MPL_EMPTY_SEQUENCE_HPP_INCLUDED diff --git a/include/boost/mpl/erase.hpp b/include/boost/mpl/erase.hpp index ff9a928..160e9c0 100644 --- a/include/boost/mpl/erase.hpp +++ b/include/boost/mpl/erase.hpp @@ -25,14 +25,14 @@ namespace boost { namespace mpl { template< typename BOOST_MPL_AUX_NA_PARAM(Sequence) - , typename BOOST_MPL_AUX_NA_PARAM(First_or_T) + , typename BOOST_MPL_AUX_NA_PARAM(First) , typename BOOST_MPL_AUX_NA_PARAM(Last) > struct erase : erase_impl< typename sequence_tag::type > - ::template apply< Sequence,First_or_T,Last > + ::template apply< Sequence,First,Last > { - BOOST_MPL_AUX_LAMBDA_SUPPORT(3,erase,(Sequence,First_or_T,Last)) + BOOST_MPL_AUX_LAMBDA_SUPPORT(3,erase,(Sequence,First,Last)) }; BOOST_MPL_AUX_NA_SPEC(3,erase) diff --git a/include/boost/mpl/eval_if.hpp b/include/boost/mpl/eval_if.hpp index 4b07d9a..cf97d6d 100755 --- a/include/boost/mpl/eval_if.hpp +++ b/include/boost/mpl/eval_if.hpp @@ -18,6 +18,7 @@ #include #include #include +#include #include namespace boost { namespace mpl { @@ -28,13 +29,16 @@ template< , typename BOOST_MPL_AUX_NA_PARAM(F2) > struct eval_if -#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) - : if_::type -{ -#else +#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) \ + || ( BOOST_WORKAROUND(BOOST_MPL_CFG_GCC, >= 0x0300) \ + && BOOST_WORKAROUND(BOOST_MPL_CFG_GCC, BOOST_TESTED_AT(0x0304)) \ + ) { typedef typename if_::type f_; typedef typename f_::type type; +#else + : if_::type +{ #endif BOOST_MPL_AUX_LAMBDA_SUPPORT(3,eval_if,(C,F1,F2)) }; @@ -47,13 +51,16 @@ template< , typename F2 > struct eval_if_c -#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) - : if_c::type -{ -#else +#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) \ + || ( BOOST_WORKAROUND(BOOST_MPL_CFG_GCC, >= 0x0300) \ + && BOOST_WORKAROUND(BOOST_MPL_CFG_GCC, BOOST_TESTED_AT(0x0304)) \ + ) { typedef typename if_c::type f_; typedef typename f_::type type; +#else + : if_c::type +{ #endif }; diff --git a/include/boost/mpl/iterator_tags.hpp b/include/boost/mpl/iterator_tags.hpp index 0eff663..1cddd27 100644 --- a/include/boost/mpl/iterator_tags.hpp +++ b/include/boost/mpl/iterator_tags.hpp @@ -18,9 +18,9 @@ namespace boost { namespace mpl { -struct forward_iterator_tag : int_<0> {}; -struct bidirectional_iterator_tag : int_<1> {}; -struct random_access_iterator_tag : int_<2> {}; +struct forward_iterator_tag : int_<0> { typedef forward_iterator_tag type; }; +struct bidirectional_iterator_tag : int_<1> { typedef bidirectional_iterator_tag type; }; +struct random_access_iterator_tag : int_<2> { typedef random_access_iterator_tag type; }; }} diff --git a/include/boost/mpl/list.hpp b/include/boost/mpl/list.hpp index f0fb45d..ee77abb 100644 --- a/include/boost/mpl/list.hpp +++ b/include/boost/mpl/list.hpp @@ -24,17 +24,17 @@ # include #if !defined(BOOST_NEEDS_TOKEN_PASTING_OP_FOR_TOKENS_JUXTAPOSING) -# define AUX778076_HEADER \ +# define AUX778076_LIST_HEADER \ BOOST_PP_CAT(list,BOOST_MPL_LIMIT_LIST_SIZE).hpp \ /**/ #else -# define AUX778076_HEADER \ +# define AUX778076_LIST_HEADER \ BOOST_PP_CAT(list,BOOST_MPL_LIMIT_LIST_SIZE)##.hpp \ /**/ #endif -# include BOOST_PP_STRINGIZE(boost/mpl/list/AUX778076_HEADER) -# undef AUX778076_HEADER +# include BOOST_PP_STRINGIZE(boost/mpl/list/AUX778076_LIST_HEADER) +# undef AUX778076_LIST_HEADER #endif #include diff --git a/include/boost/mpl/list/aux_/include_preprocessed.hpp b/include/boost/mpl/list/aux_/include_preprocessed.hpp index 1792f37..598fed8 100644 --- a/include/boost/mpl/list/aux_/include_preprocessed.hpp +++ b/include/boost/mpl/list/aux_/include_preprocessed.hpp @@ -16,12 +16,12 @@ #include #include -# define AUX_PREPROCESSED_HEADER \ +# define AUX778076_HEADER \ aux_/preprocessed/plain/BOOST_MPL_PREPROCESSED_HEADER \ /**/ -# include BOOST_PP_STRINGIZE(boost/mpl/list/AUX_PREPROCESSED_HEADER) +# include BOOST_PP_STRINGIZE(boost/mpl/list/AUX778076_HEADER) -# undef AUX_PREPROCESSED_HEADER +# undef AUX778076_HEADER #undef BOOST_MPL_PREPROCESSED_HEADER diff --git a/include/boost/mpl/list/aux_/numbered_c.hpp b/include/boost/mpl/list/aux_/numbered_c.hpp index 43b555d..86c8100 100644 --- a/include/boost/mpl/list/aux_/numbered_c.hpp +++ b/include/boost/mpl/list/aux_/numbered_c.hpp @@ -36,6 +36,7 @@ struct list1_c > { typedef list1_c type; + typedef T value_type; }; #else @@ -58,6 +59,7 @@ struct BOOST_PP_CAT(BOOST_PP_CAT(list,i),_c) > { typedef BOOST_PP_CAT(BOOST_PP_CAT(list,i),_c) type; + typedef T value_type; }; # undef MPL_AUX_LIST_C_TAIL diff --git a/include/boost/mpl/list_c.hpp b/include/boost/mpl/list_c.hpp index 0c7b059..5240102 100644 --- a/include/boost/mpl/list_c.hpp +++ b/include/boost/mpl/list_c.hpp @@ -24,17 +24,17 @@ # include #if !defined(BOOST_NEEDS_TOKEN_PASTING_OP_FOR_TOKENS_JUXTAPOSING) -# define AUX778076_HEADER \ +# define AUX778076_LIST_C_HEADER \ BOOST_PP_CAT(BOOST_PP_CAT(list,BOOST_MPL_LIMIT_LIST_SIZE),_c).hpp \ /**/ #else -# define AUX778076_HEADER \ +# define AUX778076_LIST_C_HEADER \ BOOST_PP_CAT(BOOST_PP_CAT(list,BOOST_MPL_LIMIT_LIST_SIZE),_c)##.hpp \ /**/ #endif -# include BOOST_PP_STRINGIZE(boost/mpl/list/AUX778076_HEADER) -# undef AUX778076_HEADER +# include BOOST_PP_STRINGIZE(boost/mpl/list/AUX778076_LIST_C_HEADER) +# undef AUX778076_LIST_C_HEADER # include #endif diff --git a/include/boost/mpl/max.hpp b/include/boost/mpl/max.hpp new file mode 100644 index 0000000..1899431 --- /dev/null +++ b/include/boost/mpl/max.hpp @@ -0,0 +1,19 @@ + +#ifndef BOOST_MPL_MAX_HPP_INCLUDED +#define BOOST_MPL_MAX_HPP_INCLUDED + +// Copyright Aleksey Gurtovoy 2004 +// +// 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) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Source$ +// $Date$ +// $Revision$ + +#include + +#endif // BOOST_MPL_MAX_HPP_INCLUDED diff --git a/include/boost/mpl/min.hpp b/include/boost/mpl/min.hpp new file mode 100644 index 0000000..fe802a7 --- /dev/null +++ b/include/boost/mpl/min.hpp @@ -0,0 +1,19 @@ + +#ifndef BOOST_MPL_MIN_HPP_INCLUDED +#define BOOST_MPL_MIN_HPP_INCLUDED + +// Copyright Aleksey Gurtovoy 2004 +// +// 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) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Source$ +// $Date$ +// $Revision$ + +#include + +#endif // BOOST_MPL_MIN_HPP_INCLUDED diff --git a/include/boost/mpl/numeric_cast.hpp b/include/boost/mpl/numeric_cast.hpp index ebe4c5e..aaf3776 100644 --- a/include/boost/mpl/numeric_cast.hpp +++ b/include/boost/mpl/numeric_cast.hpp @@ -14,7 +14,6 @@ // $Date$ // $Revision$ -#include #include #include @@ -37,45 +36,6 @@ template< typename SourceTag, typename TargetTag > struct BOOST_MPL_AUX_NUMERIC_ template< typename N > struct apply; }; - -namespace aux { - -template< - typename F - , typename Tag1 - , typename Tag2 - > -struct cast1st_impl -{ - template< typename N1, typename N2 > struct apply - : apply_wrap2< - F - , typename apply_wrap1< BOOST_MPL_AUX_NUMERIC_CAST,N1 >::type - , N2 - > - { - }; -}; - -template< - typename F - , typename Tag1 - , typename Tag2 - > -struct cast2nd_impl -{ - template< typename N1, typename N2 > struct apply - : apply_wrap2< - F - , N1 - , typename apply_wrap1< BOOST_MPL_AUX_NUMERIC_CAST,N2 >::type - > - { - }; -}; - -} // namespace aux - }} #endif // BOOST_MPL_NUMERIC_CAST_HPP_INCLUDED diff --git a/include/boost/mpl/pair_view.hpp b/include/boost/mpl/pair_view.hpp index db3d2a7..a41aecb 100644 --- a/include/boost/mpl/pair_view.hpp +++ b/include/boost/mpl/pair_view.hpp @@ -24,132 +24,120 @@ #include #include #include -#include -#include -#include #include #include namespace boost { namespace mpl { +namespace aux { +struct pair_iter_tag; + #if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) -template< typename I1, typename I2, typename Category > +template< typename Iter1, typename Iter2, typename Category > struct pair_iter; -template< typename Category > -struct pair_iter_ops +template< typename Category > struct prior_pair_iter { - template< typename I1, typename I2 > struct result_ + template< typename Iter1, typename Iter2 > struct apply { - typedef typename mpl::next::type i1_; - typedef typename mpl::next::type i2_; - typedef pair_iter next; - typedef pair< typename deref::type, typename deref::type > type; + typedef typename mpl::prior::type i1_; + typedef typename mpl::prior::type i2_; + typedef pair_iter type; }; }; -template<> -struct pair_iter_ops +template<> struct prior_pair_iter { - template< typename I1, typename I2 > struct result_ + template< typename Iter1, typename Iter2 > struct apply { - typedef bidirectional_iterator_tag category; - - typedef typename mpl::next::type i1_; - typedef typename mpl::next::type i2_; - typedef pair_iter next; - - typedef typename mpl::prior::type k1_; - typedef typename mpl::prior::type k2_; - typedef pair_iter prior; + typedef pair_iter type; }; }; -template<> -struct pair_iter_ops -{ - template< typename I1, typename I2 > struct result_ - { - typedef random_access_iterator_tag category; - - typedef typename mpl::next::type i1_; - typedef typename mpl::next::type i2_; - typedef pair_iter next; - - typedef typename mpl::prior::type k1_; - typedef typename mpl::prior::type k2_; - typedef pair_iter prior; - - template< typename Distance > struct BOOST_MPL_AUX_ITERATOR_ADVANCE - { - typedef typename advance::type iter1_; - typedef typename advance::type iter2_; - typedef pair_iter type; - }; - - template< typename U > struct BOOST_MPL_AUX_ITERATOR_DISTANCE - : distance - { - }; - }; -}; - -#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - - -template< typename I1, typename I2, typename Category > -struct pair_iter -#if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) - : aux::msvc_eti_base< pair_iter_ops - ::template result_ >::type #endif +} + +template< + typename Iter1 + , typename Iter2 + , typename Category + > +struct pair_iter { + typedef aux::pair_iter_tag tag; typedef Category category; + typedef Iter1 first; + typedef Iter2 second; + +#if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) + typedef pair< + typename deref::type + , typename deref::type + > type; + + typedef typename mpl::next::type i1_; + typedef typename mpl::next::type i2_; + typedef pair_iter next; + + typedef apply_wrap2< aux::prior_pair_iter,Iter1,Iter2 >::type prior; +#endif }; #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) -template< typename I1, typename I2, typename C > -struct deref< pair_iter > +template< typename Iter1, typename Iter2, typename C > +struct deref< pair_iter > { - typedef pair< typename deref::type, typename deref::type > type; + typedef pair< + typename deref::type + , typename deref::type + > type; }; -template< typename I1, typename I2, typename C > -struct next< pair_iter > +template< typename Iter1, typename Iter2, typename C > +struct next< pair_iter > { - typedef typename mpl::next::type i1_; - typedef typename mpl::next::type i2_; + typedef typename mpl::next::type i1_; + typedef typename mpl::next::type i2_; typedef pair_iter type; }; -template< typename I1, typename I2, typename C > -struct prior< pair_iter > +template< typename Iter1, typename Iter2, typename C > +struct prior< pair_iter > { - typedef typename mpl::prior::type i1_; - typedef typename mpl::prior::type i2_; + typedef typename mpl::prior::type i1_; + typedef typename mpl::prior::type i2_; typedef pair_iter type; }; -template< typename I1, typename I2, typename C, typename Distance > -struct advance< pair_iter,Distance> -{ - typedef typename mpl::advance::type iter1_; - typedef typename mpl::advance::type iter2_; - typedef pair_iter type; -}; - -template< typename I1, typename I2, typename K1, typename K2, typename C > -struct distance< pair_iter, pair_iter > - : mpl::distance -{ -}; - #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +template<> struct advance_impl +{ + template< typename Iter, typename D > struct apply + { + typedef typename mpl::advance< typename Iter::first,D >::type i1_; + typedef typename mpl::advance< typename Iter::second,D >::type i2_; + typedef pair_iter type; + }; +}; + +template<> struct distance_impl +{ + template< typename Iter1, typename Iter2 > struct apply + { + // agurt, 10/nov/04: MSVC 6.5 ICE-s on forwarding + typedef typename mpl::distance< + typename first::type + , typename first::type + >::type type; + }; +}; + + template< typename BOOST_MPL_AUX_NA_PARAM(Sequence1) , typename BOOST_MPL_AUX_NA_PARAM(Sequence2) diff --git a/include/boost/mpl/partition.hpp b/include/boost/mpl/partition.hpp index 7aaba62..3bb19e3 100644 --- a/include/boost/mpl/partition.hpp +++ b/include/boost/mpl/partition.hpp @@ -3,6 +3,7 @@ #define BOOST_MPL_PARTITION_HPP_INCLUDED // Copyright Eric Friedman 2002-2003 +// Copyright Aleksey Gurtovoy 2004 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -14,32 +15,38 @@ // $Date$ // $Revision$ -#include -#include -#include -#include -#include -#include +#include +#include namespace boost { namespace mpl { +namespace aux { + template < - typename BOOST_MPL_AUX_NA_PARAM(Sequence) - , typename BOOST_MPL_AUX_NA_PARAM(Predicate) + typename Sequence + , typename Pred + , typename In1 + , typename In2 > -struct partition +struct partition_impl + : stable_partition_impl { - typedef typename clear::type cleared_; - typedef typename iter_fold< - Sequence - , pair< cleared_,cleared_ > - , aux::partition_op - >::type type; - - BOOST_MPL_AUX_LAMBDA_SUPPORT(2,partition,(Sequence,Predicate)) }; -BOOST_MPL_AUX_NA_SPEC(2, partition) +template < + typename Sequence + , typename Pred + , typename In1 + , typename In2 + > +struct reverse_partition_impl + : reverse_stable_partition_impl +{ +}; + +} // namespace aux + +BOOST_MPL_AUX_INSERTER_ALGORITHM_DEF(4, partition) }} diff --git a/include/boost/mpl/range_c.hpp b/include/boost/mpl/range_c.hpp index 948a4cd..cc60a6f 100644 --- a/include/boost/mpl/range_c.hpp +++ b/include/boost/mpl/range_c.hpp @@ -2,7 +2,7 @@ #ifndef BOOST_MPL_RANGE_C_HPP_INCLUDED #define BOOST_MPL_RANGE_C_HPP_INCLUDED -// Copyright Aleksey Gurtovoy 2000-2002 +// Copyright Aleksey Gurtovoy 2000-2004 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -14,7 +14,6 @@ // $Date$ // $Revision$ - #include #include #include @@ -34,13 +33,14 @@ template< struct range_c { typedef aux::half_open_range_tag tag; + typedef T value_type; typedef range_c type; typedef integral_c start; typedef integral_c finish; - typedef rc_iter begin; - typedef rc_iter end; + typedef r_iter begin; + typedef r_iter end; }; }} diff --git a/include/boost/mpl/replace.hpp b/include/boost/mpl/replace.hpp index 74323ce..0abfc0c 100644 --- a/include/boost/mpl/replace.hpp +++ b/include/boost/mpl/replace.hpp @@ -18,24 +18,37 @@ #include #include -#include -#include +#include namespace boost { namespace mpl { -BOOST_MPL_AUX_COMMON_NAME_WKND(replace) +namespace aux { template< - typename BOOST_MPL_AUX_NA_PARAM(Sequence) - , typename BOOST_MPL_AUX_NA_PARAM(OldType) - , typename BOOST_MPL_AUX_NA_PARAM(NewType) + typename Sequence + , typename OldType + , typename NewType + , typename Inserter > -struct replace - : replace_if< Sequence, same_as, NewType > +struct replace_impl + : replace_if_impl< Sequence, same_as, NewType, Inserter > { }; -BOOST_MPL_AUX_NA_SPEC(3, replace) +template< + typename Sequence + , typename OldType + , typename NewType + , typename Inserter + > +struct reverse_replace_impl + : reverse_replace_if_impl< Sequence, same_as, NewType, Inserter > +{ +}; + +} // namespace aux + +BOOST_MPL_AUX_INSERTER_ALGORITHM_DEF(4, replace) }} diff --git a/include/boost/mpl/replace_if.hpp b/include/boost/mpl/replace_if.hpp index 0920757..f181b2e 100644 --- a/include/boost/mpl/replace_if.hpp +++ b/include/boost/mpl/replace_if.hpp @@ -19,14 +19,11 @@ #include #include #include -#include -#include +#include #include namespace boost { namespace mpl { -BOOST_MPL_AUX_COMMON_NAME_WKND(replace_if) - namespace aux { template< typename Predicate, typename T > @@ -51,16 +48,15 @@ struct replace_if_op }; }; -} // namespace aux template< - typename BOOST_MPL_AUX_NA_PARAM(Sequence) - , typename BOOST_MPL_AUX_NA_PARAM(Predicate) - , typename BOOST_MPL_AUX_NA_PARAM(T) - , typename BOOST_MPL_AUX_NA_PARAM(Inserter) + typename Sequence + , typename Predicate + , typename T + , typename Inserter > -struct replace_if - : transform1< +struct replace_if_impl + : transform1_impl< Sequence , protect< aux::replace_if_op > , Inserter @@ -68,7 +64,24 @@ struct replace_if { }; -BOOST_MPL_AUX_NA_SPEC(3, replace_if) +template< + typename Sequence + , typename Predicate + , typename T + , typename Inserter + > +struct reverse_replace_if_impl + : reverse_transform1_impl< + Sequence + , protect< aux::replace_if_op > + , Inserter + > +{ +}; + +} // namespace aux + +BOOST_MPL_AUX_INSERTER_ALGORITHM_DEF(4, replace_if) }} diff --git a/include/boost/mpl/set/aux_/numbered_c.hpp b/include/boost/mpl/set/aux_/numbered_c.hpp new file mode 100644 index 0000000..cc18a52 --- /dev/null +++ b/include/boost/mpl/set/aux_/numbered_c.hpp @@ -0,0 +1,48 @@ + +// NO INCLUDE GUARDS, THE HEADER IS INTENDED FOR MULTIPLE INCLUSION + +#if defined(BOOST_PP_IS_ITERATING) + +// Copyright Aleksey Gurtovoy 2000-2004 +// +// 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) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Source$ +// $Date$ +// $Revision$ + +#include +#include +#include +#include + +#define i_ BOOST_PP_FRAME_ITERATION(1) + +# define AUX778076_SET_C_TAIL(set, i_, T, C) \ + BOOST_PP_CAT(BOOST_PP_CAT(set,i_),_c)< \ + T BOOST_PP_ENUM_TRAILING_PARAMS(i_, C) \ + > \ + /**/ + +template< + typename T + , BOOST_PP_ENUM_PARAMS(i_, T C) + > +struct BOOST_PP_CAT(BOOST_PP_CAT(set,i_),_c) + : s_item< + integral_c + , AUX778076_SET_C_TAIL(set,BOOST_PP_DEC(i_), T, C) + > +{ + typedef BOOST_PP_CAT(BOOST_PP_CAT(set,i_),_c) type; +}; + +# undef AUX778076_SET_C_TAIL + +#undef i_ + +#endif // BOOST_PP_IS_ITERATING diff --git a/include/boost/mpl/set/set0_c.hpp b/include/boost/mpl/set/set0_c.hpp new file mode 100644 index 0000000..7394103 --- /dev/null +++ b/include/boost/mpl/set/set0_c.hpp @@ -0,0 +1,32 @@ + +#ifndef BOOST_MPL_SET_SET0_C_HPP_INCLUDED +#define BOOST_MPL_SET_SET0_C_HPP_INCLUDED + +// Copyright Aleksey Gurtovoy 2003-2004 +// Copyright David Abrahams 2003-2004 +// +// 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) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Source$ +// $Date$ +// $Revision$ + +#include +#include + +namespace boost { namespace mpl { + +template< typename T > struct set0_c + : set0<> +{ + typedef set0_c type; + typedef T value_type; +}; + +}} + +#endif // BOOST_MPL_SET_SET0_C_HPP_INCLUDED diff --git a/include/boost/mpl/set/set10_c.hpp b/include/boost/mpl/set/set10_c.hpp new file mode 100644 index 0000000..9388199 --- /dev/null +++ b/include/boost/mpl/set/set10_c.hpp @@ -0,0 +1,45 @@ + +#ifndef BOOST_MPL_SET_SET10_C_HPP_INCLUDED +#define BOOST_MPL_SET_SET10_C_HPP_INCLUDED + +// Copyright Aleksey Gurtovoy 2000-2004 +// Copyright David Abrahams 2003-2004 +// +// 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) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Source$ +// $Date$ +// $Revision$ + +#if !defined(BOOST_MPL_PREPROCESSING_MODE) +# include +# include +#endif + +#include + +#if !defined(BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS) \ + && !defined(BOOST_MPL_PREPROCESSING_MODE) + +# define BOOST_MPL_PREPROCESSED_HEADER set10_c.hpp +# include + +#else + +# include + +namespace boost { namespace mpl { + +# define BOOST_PP_ITERATION_PARAMS_1 \ + (3,(1, 10, )) +# include BOOST_PP_ITERATE() + +}} + +#endif // BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS + +#endif // BOOST_MPL_SET_SET10_C_HPP_INCLUDED diff --git a/include/boost/mpl/set/set20_c.hpp b/include/boost/mpl/set/set20_c.hpp new file mode 100644 index 0000000..50549e8 --- /dev/null +++ b/include/boost/mpl/set/set20_c.hpp @@ -0,0 +1,45 @@ + +#ifndef BOOST_MPL_SET_SET20_C_HPP_INCLUDED +#define BOOST_MPL_SET_SET20_C_HPP_INCLUDED + +// Copyright Aleksey Gurtovoy 2000-2004 +// Copyright David Abrahams 2003-2004 +// +// 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) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Source$ +// $Date$ +// $Revision$ + +#if !defined(BOOST_MPL_PREPROCESSING_MODE) +# include +# include +#endif + +#include + +#if !defined(BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS) \ + && !defined(BOOST_MPL_PREPROCESSING_MODE) + +# define BOOST_MPL_PREPROCESSED_HEADER set20_c.hpp +# include + +#else + +# include + +namespace boost { namespace mpl { + +# define BOOST_PP_ITERATION_PARAMS_1 \ + (3,(11, 20, )) +# include BOOST_PP_ITERATE() + +}} + +#endif // BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS + +#endif // BOOST_MPL_SET_SET20_C_HPP_INCLUDED diff --git a/include/boost/mpl/set/set30_c.hpp b/include/boost/mpl/set/set30_c.hpp new file mode 100644 index 0000000..4824ffd --- /dev/null +++ b/include/boost/mpl/set/set30_c.hpp @@ -0,0 +1,45 @@ + +#ifndef BOOST_MPL_SET_SET30_C_HPP_INCLUDED +#define BOOST_MPL_SET_SET30_C_HPP_INCLUDED + +// Copyright Aleksey Gurtovoy 2000-2004 +// Copyright David Abrahams 2003-2004 +// +// 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) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Source$ +// $Date$ +// $Revision$ + +#if !defined(BOOST_MPL_PREPROCESSING_MODE) +# include +# include +#endif + +#include + +#if !defined(BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS) \ + && !defined(BOOST_MPL_PREPROCESSING_MODE) + +# define BOOST_MPL_PREPROCESSED_HEADER set30_c.hpp +# include + +#else + +# include + +namespace boost { namespace mpl { + +# define BOOST_PP_ITERATION_PARAMS_1 \ + (3,(21, 30, )) +# include BOOST_PP_ITERATE() + +}} + +#endif // BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS + +#endif // BOOST_MPL_SET_SET30_C_HPP_INCLUDED diff --git a/include/boost/mpl/set/set40_c.hpp b/include/boost/mpl/set/set40_c.hpp new file mode 100644 index 0000000..72e0da5 --- /dev/null +++ b/include/boost/mpl/set/set40_c.hpp @@ -0,0 +1,45 @@ + +#ifndef BOOST_MPL_SET_SET40_C_HPP_INCLUDED +#define BOOST_MPL_SET_SET40_C_HPP_INCLUDED + +// Copyright Aleksey Gurtovoy 2000-2004 +// Copyright David Abrahams 2003-2004 +// +// 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) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Source$ +// $Date$ +// $Revision$ + +#if !defined(BOOST_MPL_PREPROCESSING_MODE) +# include +# include +#endif + +#include + +#if !defined(BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS) \ + && !defined(BOOST_MPL_PREPROCESSING_MODE) + +# define BOOST_MPL_PREPROCESSED_HEADER set40_c.hpp +# include + +#else + +# include + +namespace boost { namespace mpl { + +# define BOOST_PP_ITERATION_PARAMS_1 \ + (3,(31, 40, )) +# include BOOST_PP_ITERATE() + +}} + +#endif // BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS + +#endif // BOOST_MPL_SET_SET40_C_HPP_INCLUDED diff --git a/include/boost/mpl/set/set50_c.hpp b/include/boost/mpl/set/set50_c.hpp new file mode 100644 index 0000000..2f4fdaa --- /dev/null +++ b/include/boost/mpl/set/set50_c.hpp @@ -0,0 +1,45 @@ + +#ifndef BOOST_MPL_SET_SET50_C_HPP_INCLUDED +#define BOOST_MPL_SET_SET50_C_HPP_INCLUDED + +// Copyright Aleksey Gurtovoy 2000-2004 +// Copyright David Abrahams 2003-2004 +// +// 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) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Source$ +// $Date$ +// $Revision$ + +#if !defined(BOOST_MPL_PREPROCESSING_MODE) +# include +# include +#endif + +#include + +#if !defined(BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS) \ + && !defined(BOOST_MPL_PREPROCESSING_MODE) + +# define BOOST_MPL_PREPROCESSED_HEADER set50_c.hpp +# include + +#else + +# include + +namespace boost { namespace mpl { + +# define BOOST_PP_ITERATION_PARAMS_1 \ + (3,(41, 50, )) +# include BOOST_PP_ITERATE() + +}} + +#endif // BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS + +#endif // BOOST_MPL_SET_SET50_C_HPP_INCLUDED diff --git a/include/boost/mpl/set_c.hpp b/include/boost/mpl/set_c.hpp new file mode 100644 index 0000000..72cbf19 --- /dev/null +++ b/include/boost/mpl/set_c.hpp @@ -0,0 +1,60 @@ + +#ifndef BOOST_MPL_SET_C_HPP_INCLUDED +#define BOOST_MPL_SET_C_HPP_INCLUDED + +// Copyright Aleksey Gurtovoy 2000-2004 +// +// 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) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Source$ +// $Date$ +// $Revision$ + +#if !defined(BOOST_MPL_PREPROCESSING_MODE) +# include +# include +# include + +# include +# include +# include + +#if !defined(BOOST_NEEDS_TOKEN_PASTING_OP_FOR_TOKENS_JUXTAPOSING) +# define AUX778076_SET_C_HEADER \ + BOOST_PP_CAT(BOOST_PP_CAT(set,BOOST_MPL_LIMIT_SET_SIZE),_c).hpp \ + /**/ +#else +# define AUX778076_SET_C_HEADER \ + BOOST_PP_CAT(BOOST_PP_CAT(set,BOOST_MPL_LIMIT_SET_SIZE),_c)##.hpp \ + /**/ +#endif + +# include BOOST_PP_STRINGIZE(boost/mpl/set/AUX778076_SET_C_HEADER) +# undef AUX778076_SET_C_HEADER +# include +#endif + +#include + +#if !defined(BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS) \ + && !defined(BOOST_MPL_PREPROCESSING_MODE) + +# define BOOST_MPL_PREPROCESSED_HEADER set_c.hpp +# include + +#else + +# include + +# define AUX778076_SEQUENCE_NAME set_c +# define AUX778076_SEQUENCE_LIMIT BOOST_MPL_LIMIT_SET_SIZE +# define AUX778076_SEQUENCE_NAME_N(n) BOOST_PP_CAT(BOOST_PP_CAT(set,n),_c) +# define AUX778076_SEQUENCE_INTEGRAL_WRAPPER +# include + +#endif // BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS +#endif // BOOST_MPL_SET_C_HPP_INCLUDED diff --git a/include/boost/mpl/single_view.hpp b/include/boost/mpl/single_view.hpp index e419147..153a7e0 100644 --- a/include/boost/mpl/single_view.hpp +++ b/include/boost/mpl/single_view.hpp @@ -25,8 +25,8 @@ template< > struct single_view : iterator_range< - aux::single_element_iter - , aux::single_element_iter + aux::sel_iter + , aux::sel_iter > { }; diff --git a/include/boost/mpl/sort.hpp b/include/boost/mpl/sort.hpp index 2930aa2..f304cba 100644 --- a/include/boost/mpl/sort.hpp +++ b/include/boost/mpl/sort.hpp @@ -15,27 +15,12 @@ // $Date$ // $Revision$ -#include -#include -#include #include -#include -#include +#include namespace boost { namespace mpl { -template < - typename BOOST_MPL_AUX_NA_PARAM(Sequence) - , typename Predicate = less<_,_> - > -struct sort - : sort_impl< typename sequence_tag::type > - ::template apply< Sequence,Predicate > -{ - BOOST_MPL_AUX_LAMBDA_SUPPORT(2,sort,(Sequence,Predicate)) -}; - -BOOST_MPL_AUX_NA_SPEC(1, sort) +BOOST_MPL_AUX_INSERTER_ALGORITHM_DEF(3, sort) }} diff --git a/include/boost/mpl/sort_fwd.hpp b/include/boost/mpl/sort_fwd.hpp deleted file mode 100644 index 2806baf..0000000 --- a/include/boost/mpl/sort_fwd.hpp +++ /dev/null @@ -1,29 +0,0 @@ - -#ifndef BOOST_MPL_SORT_FWD_HPP_INCLUDED -#define BOOST_MPL_SORT_FWD_HPP_INCLUDED - -// Copyright Eric Friedman 2002-2003 -// Copyright Aleksey Gurtovoy 2004 -// -// 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) -// -// See http://www.boost.org/libs/mpl for documentation. - -// $Source$ -// $Date$ -// $Revision$ - -#include - -namespace boost { namespace mpl { - -BOOST_MPL_AUX_COMMON_NAME_WKND(sort) - -template< typename Tag > struct sort_impl; -template< typename Sequence, typename Predicate > struct sort; - -}} - -#endif // BOOST_MPL_SORT_FWD_HPP_INCLUDED diff --git a/include/boost/mpl/stable_partition.hpp b/include/boost/mpl/stable_partition.hpp index 39ba7ef..7ce5ff9 100644 --- a/include/boost/mpl/stable_partition.hpp +++ b/include/boost/mpl/stable_partition.hpp @@ -3,6 +3,7 @@ #define BOOST_MPL_STABLE_PARTITION_HPP_INCLUDED // Copyright Eric Friedman 2002-2003 +// Copyright Aleksey Gurtovoy 2004 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -14,32 +15,60 @@ // $Date$ // $Revision$ +#include +#include +#include #include -#include -#include -#include -#include -#include +#include +#include namespace boost { namespace mpl { +namespace aux { + template < - typename BOOST_MPL_AUX_NA_PARAM(Sequence) - , typename BOOST_MPL_AUX_NA_PARAM(Predicate) + typename Sequence + , typename Pred + , typename In + , typename In2 + , typename In1 = typename if_na::type > -struct stable_partition -{ - typedef typename clear::type cleared_; - typedef typename reverse_iter_fold< +struct stable_partition_impl + : fold< Sequence - , pair< cleared_,cleared_ > - , aux::partition_op - >::type type; - - BOOST_MPL_AUX_LAMBDA_SUPPORT(2,stable_partition,(Sequence,Predicate)) + , pair< typename In1::state, typename In2::state > + , protect< partition_op< + Pred + , typename In1::operation + , typename In2::operation + > > + > +{ }; -BOOST_MPL_AUX_NA_SPEC(2, stable_partition) +template < + typename Sequence + , typename Pred + , typename In + , typename In2 + , typename In1 = typename if_na::type + > +struct reverse_stable_partition_impl + : reverse_fold< + Sequence + , pair< typename In1::state, typename In2::state > + , protect< partition_op< + Pred + , typename In1::operation + , typename In2::operation + > > + > +{ +}; + +} // namespace aux + +BOOST_MPL_AUX_INSERTER_ALGORITHM_DEF(4, stable_partition) }} diff --git a/include/boost/mpl/vector.hpp b/include/boost/mpl/vector.hpp index be9cacf..b10d14c 100644 --- a/include/boost/mpl/vector.hpp +++ b/include/boost/mpl/vector.hpp @@ -24,17 +24,17 @@ # include #if !defined(BOOST_NEEDS_TOKEN_PASTING_OP_FOR_TOKENS_JUXTAPOSING) -# define AUX778076_HEADER \ +# define AUX778076_VECTOR_HEADER \ BOOST_PP_CAT(vector, BOOST_MPL_LIMIT_VECTOR_SIZE).hpp \ /**/ #else -# define AUX778076_HEADER \ +# define AUX778076_VECTOR_HEADER \ BOOST_PP_CAT(vector, BOOST_MPL_LIMIT_VECTOR_SIZE)##.hpp \ /**/ #endif -# include BOOST_PP_STRINGIZE(boost/mpl/vector/AUX778076_HEADER) -# undef AUX778076_HEADER +# include BOOST_PP_STRINGIZE(boost/mpl/vector/AUX778076_VECTOR_HEADER) +# undef AUX778076_VECTOR_HEADER #endif #include diff --git a/include/boost/mpl/vector/aux_/include_preprocessed.hpp b/include/boost/mpl/vector/aux_/include_preprocessed.hpp index 479b7e8..ee2f77d 100644 --- a/include/boost/mpl/vector/aux_/include_preprocessed.hpp +++ b/include/boost/mpl/vector/aux_/include_preprocessed.hpp @@ -21,28 +21,28 @@ #include #if defined(BOOST_MPL_CFG_TYPEOF_BASED_SEQUENCES) -# define AUX_VECTOR_INCLIDE_DIR typeof_based +# define AUX778076_INCLUDE_DIR typeof_based #elif defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ || defined(BOOST_MPL_CFG_NO_NONTYPE_TEMPLATE_PARTIAL_SPEC) -# define AUX_VECTOR_INCLIDE_DIR no_ctps +# define AUX778076_INCLUDE_DIR no_ctps #else -# define AUX_VECTOR_INCLIDE_DIR plain +# define AUX778076_INCLUDE_DIR plain #endif #if !defined(BOOST_NEEDS_TOKEN_PASTING_OP_FOR_TOKENS_JUXTAPOSING) -# define AUX_PREPROCESSED_HEADER \ - AUX_VECTOR_INCLIDE_DIR/BOOST_MPL_PREPROCESSED_HEADER \ +# define AUX778076_HEADER \ + AUX778076_INCLUDE_DIR/BOOST_MPL_PREPROCESSED_HEADER \ /**/ #else -# define AUX_PREPROCESSED_HEADER \ - BOOST_PP_CAT(AUX_VECTOR_INCLIDE_DIR,/)##BOOST_MPL_PREPROCESSED_HEADER \ +# define AUX778076_HEADER \ + BOOST_PP_CAT(AUX778076_INCLUDE_DIR,/)##BOOST_MPL_PREPROCESSED_HEADER \ /**/ #endif -# include BOOST_PP_STRINGIZE(boost/mpl/vector/aux_/preprocessed/AUX_PREPROCESSED_HEADER) +# include BOOST_PP_STRINGIZE(boost/mpl/vector/aux_/preprocessed/AUX778076_HEADER) -# undef AUX_PREPROCESSED_HEADER -# undef AUX_VECTOR_INCLIDE_DIR +# undef AUX778076_HEADER +# undef AUX778076_INCLUDE_DIR #undef BOOST_MPL_PREPROCESSED_HEADER diff --git a/include/boost/mpl/vector/aux_/iterator.hpp b/include/boost/mpl/vector/aux_/iterator.hpp index fdec16f..58d31a5 100644 --- a/include/boost/mpl/vector/aux_/iterator.hpp +++ b/include/boost/mpl/vector/aux_/iterator.hpp @@ -22,7 +22,6 @@ #include #include #include -#include #include #include #include @@ -114,6 +113,15 @@ template<> struct advance_impl }; }; +template<> struct distance_impl +{ + template< typename Iter1, typename Iter2 > struct apply + { + enum { pos1_ = Iter1::pos_, pos2_ = Iter2::pos_ }; + typedef long_<( pos2_ - pos1_ )> type; + BOOST_STATIC_CONSTANT(long, value = ( pos2_ - pos1_ )); + }; +}; #endif diff --git a/include/boost/mpl/vector/aux_/numbered_c.hpp b/include/boost/mpl/vector/aux_/numbered_c.hpp index 37afe54..ed47c28 100644 --- a/include/boost/mpl/vector/aux_/numbered_c.hpp +++ b/include/boost/mpl/vector/aux_/numbered_c.hpp @@ -44,6 +44,7 @@ struct BOOST_PP_CAT(BOOST_PP_CAT(vector,i_),_c) > { typedef BOOST_PP_CAT(BOOST_PP_CAT(vector,i_),_c) type; + typedef T value_type; }; #endif @@ -63,6 +64,8 @@ template< struct BOOST_PP_CAT(BOOST_PP_CAT(vector,i_),_c) : BOOST_PP_CAT(vector,i_)< BOOST_PP_REPEAT(i_,AUX778076_VECTOR_C_PARAM_FUNC,C) > { + typedef BOOST_PP_CAT(BOOST_PP_CAT(vector,i_),_c) type; + typedef T value_type; }; # undef AUX778076_VECTOR_C_PARAM_FUNC diff --git a/include/boost/mpl/vector/aux_/tag.hpp b/include/boost/mpl/vector/aux_/tag.hpp index 940f490..29a0a3b 100644 --- a/include/boost/mpl/vector/aux_/tag.hpp +++ b/include/boost/mpl/vector/aux_/tag.hpp @@ -15,6 +15,7 @@ // $Revision$ #include +#include namespace boost { namespace mpl { namespace aux { @@ -23,7 +24,7 @@ struct v_iter_tag; #if defined(BOOST_MPL_CFG_TYPEOF_BASED_SEQUENCES) struct vector_tag; #else -template< long N > struct vector_tag; +template< BOOST_MPL_AUX_NTTP_DECL(long, N) > struct vector_tag; #endif }}} diff --git a/include/boost/mpl/vector/vector0_c.hpp b/include/boost/mpl/vector/vector0_c.hpp index 3f2255a..b225491 100644 --- a/include/boost/mpl/vector/vector0_c.hpp +++ b/include/boost/mpl/vector/vector0_c.hpp @@ -15,6 +15,7 @@ // $Revision$ #include +#include namespace boost { namespace mpl { @@ -22,6 +23,7 @@ template< typename T > struct vector0_c : vector0<> { typedef vector0_c type; + typedef T value_type; }; }} diff --git a/include/boost/mpl/vector_c.hpp b/include/boost/mpl/vector_c.hpp index 450760d..7f5cb4f 100644 --- a/include/boost/mpl/vector_c.hpp +++ b/include/boost/mpl/vector_c.hpp @@ -24,17 +24,17 @@ # include #if !defined(BOOST_NEEDS_TOKEN_PASTING_OP_FOR_TOKENS_JUXTAPOSING) -# define AUX778076_HEADER \ +# define AUX778076_VECTOR_C_HEADER \ BOOST_PP_CAT(BOOST_PP_CAT(vector,BOOST_MPL_LIMIT_VECTOR_SIZE),_c).hpp \ /**/ #else -# define AUX778076_HEADER \ +# define AUX778076_VECTOR_C_HEADER \ BOOST_PP_CAT(BOOST_PP_CAT(vector,BOOST_MPL_LIMIT_VECTOR_SIZE),_c)##.hpp \ /**/ #endif -# include BOOST_PP_STRINGIZE(boost/mpl/vector/AUX778076_HEADER) -# undef AUX778076_HEADER +# include BOOST_PP_STRINGIZE(boost/mpl/vector/AUX778076_VECTOR_C_HEADER) +# undef AUX778076_VECTOR_C_HEADER # include #endif