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

Revision 857, 2.0 KB checked in by igarcia, 19 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_LESS_HPP)
11#define FUSION_SEQUENCE_DETAIL_SEQUENCE_LESS_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_less_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)
26            && T::call(fusion::next(a), fusion::next(b));
27        }
28    }
29
30    template <typename Seq1, typename Seq2>
31    struct sequence_less
32    {
33        typedef typename meta::end<Seq1>::type end1_type;
34        typedef typename meta::end<Seq2>::type end2_type;
35
36        template <typename I1, typename I2>
37        static bool
38        call(I1 const& a, I2 const& b)
39        {
40            typename meta::equal_to<I1, end1_type>::type eq;
41            return call(a, b, eq);
42        }
43
44        template <typename I1, typename I2>
45        static bool
46        call(I1 const&, I2 const&, mpl::true_)
47        {
48            BOOST_STATIC_ASSERT((meta::equal_to<I2, end2_type>::value));
49            return false;
50        }
51
52        template <typename I1, typename I2>
53        static bool
54        call(I1 const& a, I2 const& b, mpl::false_)
55        {
56            return sequence_less_detail::call(sequence_less<Seq1,Seq2>(),a,b);
57        }
58    };
59}}}
60
61#endif
Note: See TracBrowser for help on using the repository browser.