Files

113 lines
2.6 KiB
C++
Raw Permalink Normal View History

2002-09-15 22:13:24 +00:00
#ifndef BOOST_MPL_EQUAL_HPP_INCLUDED
#define BOOST_MPL_EQUAL_HPP_INCLUDED
2004-09-02 15:41:37 +00:00
// 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.
2002-09-15 22:13:24 +00:00
2008-10-10 09:10:26 +00:00
// $Id$
2004-09-02 15:41:37 +00:00
// $Date$
// $Revision$
#include <boost/mpl/aux_/iter_fold_if_impl.hpp>
#include <boost/mpl/aux_/iter_apply.hpp>
#include <boost/mpl/and.hpp>
#include <boost/mpl/not.hpp>
#include <boost/mpl/begin_end.hpp>
#include <boost/mpl/next.hpp>
#include <boost/mpl/always.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/mpl/lambda.hpp>
#include <boost/mpl/bind.hpp>
#include <boost/mpl/apply.hpp>
#include <boost/mpl/void.hpp>
#include <boost/mpl/aux_/na_spec.hpp>
#include <boost/mpl/aux_/lambda_support.hpp>
2014-03-25 08:31:37 +00:00
#include <boost/mpl/aux_/msvc_eti_base.hpp>
2004-09-02 15:41:37 +00:00
#include <boost/type_traits/is_same.hpp>
namespace boost { namespace mpl {
2002-09-15 22:13:24 +00:00
namespace aux {
template<
typename Predicate
, typename LastIterator1
, typename LastIterator2
>
struct equal_pred
{
template<
typename Iterator2
, typename Iterator1
>
struct apply
{
2003-02-25 23:11:41 +00:00
typedef typename and_<
not_< is_same<Iterator1,LastIterator1> >
, not_< is_same<Iterator2,LastIterator2> >
2002-09-15 22:13:24 +00:00
, aux::iter_apply2<Predicate,Iterator1,Iterator2>
>::type type;
};
};
template<
2004-09-02 15:41:37 +00:00
typename Sequence1
, typename Sequence2
, typename Predicate
2002-09-15 22:13:24 +00:00
>
2004-09-02 15:41:37 +00:00
struct equal_impl
2002-09-15 22:13:24 +00:00
{
typedef typename begin<Sequence1>::type first1_;
typedef typename begin<Sequence2>::type first2_;
typedef typename end<Sequence1>::type last1_;
typedef typename end<Sequence2>::type last2_;
typedef aux::iter_fold_if_impl<
first1_
, first2_
, next<>
2004-09-02 15:41:37 +00:00
, protect< aux::equal_pred<Predicate,last1_,last2_> >
2002-09-15 22:13:24 +00:00
, void_
2003-02-25 23:11:41 +00:00
, always<false_>
2002-09-15 22:13:24 +00:00
> fold_;
typedef typename fold_::iterator iter1_;
typedef typename fold_::state iter2_;
2003-02-25 23:11:41 +00:00
typedef and_<
2002-09-15 22:13:24 +00:00
is_same<iter1_,last1_>
, is_same<iter2_,last2_>
> result_;
typedef typename result_::type type;
2004-09-02 15:41:37 +00:00
};
2002-09-15 22:13:24 +00:00
2004-09-02 15:41:37 +00:00
} // namespace aux
template<
typename BOOST_MPL_AUX_NA_PARAM(Sequence1)
, typename BOOST_MPL_AUX_NA_PARAM(Sequence2)
, typename Predicate = is_same<_,_>
>
struct equal
2014-03-25 08:31:37 +00:00
: aux::msvc_eti_base<
typename aux::equal_impl<Sequence1,Sequence2,Predicate>::type
>::type
2004-09-02 15:41:37 +00:00
{
2002-09-15 22:13:24 +00:00
BOOST_MPL_AUX_LAMBDA_SUPPORT(2,equal,(Sequence1,Sequence2))
};
2004-09-02 15:41:37 +00:00
BOOST_MPL_AUX_NA_SPEC(2, equal)
2003-03-11 11:59:49 +00:00
2004-09-02 15:41:37 +00:00
}}
2002-09-15 22:13:24 +00:00
#endif // BOOST_MPL_EQUAL_HPP_INCLUDED