| 1 | /*============================================================================= |
| 2 | Copyright (c) 1999-2003 Jaakko Jarvi |
| 3 | Copyright (c) 2001-2011 Joel de Guzman |
| 4 | |
| 5 | Distributed under the Boost Software License, Version 1.0. (See accompanying |
| 6 | file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |
| 7 | ==============================================================================*/ |
| 8 | #if !defined(FUSION_EQUAL_TO_05052005_1142) |
| 9 | #define FUSION_EQUAL_TO_05052005_1142 |
| 10 | |
| 11 | #include <boost/fusion/support/config.hpp> |
| 12 | #include <boost/mpl/bool.hpp> |
| 13 | #include <boost/fusion/iterator/deref.hpp> |
| 14 | #include <boost/fusion/iterator/next.hpp> |
| 15 | #include <boost/fusion/iterator/equal_to.hpp> |
| 16 | #include <boost/fusion/support/as_const.hpp> |
| 17 | |
| 18 | namespace boost { namespace fusion { namespace detail |
| 19 | { |
| 20 | template <typename Seq1, typename Seq2, bool same_size> |
| 21 | struct sequence_equal_to |
| 22 | { |
| 23 | typedef typename result_of::end<Seq1>::type end1_type; |
| 24 | typedef typename result_of::end<Seq2>::type end2_type; |
| 25 | |
| 26 | template <typename I1, typename I2> |
| 27 | BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED |
| 28 | static bool |
| 29 | call(I1 const&, I2 const&, mpl::true_) |
| 30 | { |
| 31 | return true; |
| 32 | } |
| 33 | |
| 34 | template <typename I1, typename I2> |
| 35 | BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED |
| 36 | static bool |
| 37 | call(I1 const& a, I2 const& b, mpl::false_) |
| 38 | { |
| 39 | return extension::as_const(*a) == extension::as_const(*b) |
| 40 | && call(fusion::next(a), fusion::next(b)); |
| 41 | } |
| 42 | |
| 43 | template <typename I1, typename I2> |
| 44 | BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED |
| 45 | static bool |
| 46 | call(I1 const& a, I2 const& b) |
| 47 | { |
| 48 | typename result_of::equal_to<I1, end1_type>::type eq; |
| 49 | return call(a, b, eq); |
| 50 | } |
| 51 | }; |
| 52 | |
| 53 | template <typename Seq1, typename Seq2> |
| 54 | struct sequence_equal_to<Seq1, Seq2, false> |
| 55 | { |
| 56 | template <typename I1, typename I2> |
| 57 | BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED |
| 58 | static bool |
| 59 | call(I1 const& /*a*/, I2 const& /*b*/) |
| 60 | { |
| 61 | return false; |
| 62 | } |
| 63 | }; |
| 64 | }}} |
| 65 | |
| 66 | #endif |
| 67 | |