Back to home page

EIC code displayed by LXR

 
 

    


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

0001 
0002 #ifndef BOOST_MPL_EQUAL_HPP_INCLUDED
0003 #define BOOST_MPL_EQUAL_HPP_INCLUDED
0004 
0005 // Copyright Aleksey Gurtovoy 2000-2004
0006 //
0007 // Distributed under the Boost Software License, Version 1.0. 
0008 // (See accompanying file LICENSE_1_0.txt or copy at 
0009 // http://www.boost.org/LICENSE_1_0.txt)
0010 //
0011 // See http://www.boost.org/libs/mpl for documentation.
0012 
0013 // $Id$
0014 // $Date$
0015 // $Revision$
0016 
0017 #include <boost/mpl/aux_/iter_fold_if_impl.hpp>
0018 #include <boost/mpl/aux_/iter_apply.hpp>
0019 #include <boost/mpl/and.hpp>
0020 #include <boost/mpl/not.hpp>
0021 #include <boost/mpl/begin_end.hpp>
0022 #include <boost/mpl/next.hpp>
0023 #include <boost/mpl/always.hpp>
0024 #include <boost/mpl/bool.hpp>
0025 #include <boost/mpl/lambda.hpp>
0026 #include <boost/mpl/bind.hpp>
0027 #include <boost/mpl/apply.hpp>
0028 #include <boost/mpl/void.hpp>
0029 #include <boost/mpl/aux_/na_spec.hpp>
0030 #include <boost/mpl/aux_/lambda_support.hpp>
0031 #include <boost/mpl/aux_/msvc_eti_base.hpp>
0032 
0033 #include <boost/type_traits/is_same.hpp>
0034 
0035 namespace boost { namespace mpl {
0036 
0037 namespace aux {
0038 
0039 template<
0040       typename Predicate
0041     , typename LastIterator1
0042     , typename LastIterator2
0043     >
0044 struct equal_pred
0045 {
0046     template<
0047           typename Iterator2
0048         , typename Iterator1
0049         >
0050     struct apply
0051     {
0052         typedef typename and_< 
0053               not_< is_same<Iterator1,LastIterator1> >
0054             , not_< is_same<Iterator2,LastIterator2> >
0055             , aux::iter_apply2<Predicate,Iterator1,Iterator2>
0056             >::type type;
0057     };
0058 };
0059 
0060 template<
0061       typename Sequence1
0062     , typename Sequence2
0063     , typename Predicate
0064     >
0065 struct equal_impl
0066 {
0067     typedef typename begin<Sequence1>::type first1_;
0068     typedef typename begin<Sequence2>::type first2_;
0069     typedef typename end<Sequence1>::type last1_;
0070     typedef typename end<Sequence2>::type last2_;
0071 
0072     typedef aux::iter_fold_if_impl<
0073           first1_
0074         , first2_
0075         , next<>
0076         , protect< aux::equal_pred<Predicate,last1_,last2_> >
0077         , void_
0078         , always<false_>
0079         > fold_;
0080 
0081     typedef typename fold_::iterator iter1_;
0082     typedef typename fold_::state iter2_;
0083     typedef and_<
0084           is_same<iter1_,last1_>
0085         , is_same<iter2_,last2_>
0086         > result_;
0087 
0088     typedef typename result_::type type;
0089 };
0090 
0091 
0092 } // namespace aux
0093 
0094 
0095 template<
0096       typename BOOST_MPL_AUX_NA_PARAM(Sequence1)
0097     , typename BOOST_MPL_AUX_NA_PARAM(Sequence2)
0098     , typename Predicate = is_same<_,_>
0099     >
0100 struct equal
0101     : aux::msvc_eti_base< 
0102           typename aux::equal_impl<Sequence1,Sequence2,Predicate>::type
0103         >::type
0104 {
0105     BOOST_MPL_AUX_LAMBDA_SUPPORT(2,equal,(Sequence1,Sequence2))
0106 };
0107 
0108 BOOST_MPL_AUX_NA_SPEC(2, equal)
0109 
0110 }}
0111 
0112 #endif // BOOST_MPL_EQUAL_HPP_INCLUDED