source: NonGTP/Boost/boost/spirit/fusion/sequence/detail/sequence_greater_equal.hpp @ 857

Revision 857, 2.1 KB checked in by igarcia, 18 years ago (diff)
Line 
1/*=============================================================================
2    Copyright (c) 1999-2003 Jaakko Järvi
3    Copyright (c) 2001-2003 Joel de Guzman
4    Copyright (c) 2004 Peder Holt
5
6    Use, modification and distribution is subject to the Boost Software
7    License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
8    http://www.boost.org/LICENSE_1_0.txt)
9==============================================================================*/
10#if !defined(FUSION_SEQUENCE_DETAIL_SEQUENCE_GREATER_EQUAL_HPP)
11#define FUSION_SEQUENCE_DETAIL_SEQUENCE_GREATER_EQUAL_HPP
12
13#include <boost/mpl/bool.hpp>
14#include <boost/static_assert.hpp>
15#include <boost/spirit/fusion/iterator/deref.hpp>
16#include <boost/spirit/fusion/iterator/next.hpp>
17#include <boost/spirit/fusion/iterator/equal_to.hpp>
18
19namespace boost { namespace fusion { namespace detail
20{
21    namespace sequence_greater_equal_detail {
22        template <typename T,typename I1, typename I2>
23        bool call(T const& self,I1 const& a, I2 const& b) {
24            return *a >= *b
25                && (!(*b >= *a) || T::call(fusion::next(a), fusion::next(b)));;
26        }
27    }
28
29    template <typename Seq1, typename Seq2>
30    struct sequence_greater_equal
31    {
32        typedef typename meta::end<Seq1>::type end1_type;
33        typedef typename meta::end<Seq2>::type end2_type;
34
35        template <typename I1, typename I2>
36        static bool
37        call(I1 const& a, I2 const& b)
38        {
39            typename meta::equal_to<I1, end1_type>::type eq;
40            return call(a, b, eq);
41        }
42       
43        template <typename I1, typename I2>
44        static bool
45        call(I1 const&, I2 const&, mpl::true_)
46        {
47            BOOST_STATIC_ASSERT((meta::equal_to<I2, end2_type>::value));
48            return true;
49        }
50
51        template <typename I1, typename I2>
52        static bool
53        call(I1 const& a, I2 const& b, mpl::false_)
54        {
55            return sequence_greater_equal_detail::call(sequence_greater_equal<Seq1,Seq2>(),a,b);
56        }
57    };
58}}}
59
60#endif
Note: See TracBrowser for help on using the repository browser.