]> git.donarmstrong.com Git - rsem.git/blob - boost/fusion/sequence/comparison/less_equal.hpp
RSEM Source Codes
[rsem.git] / boost / fusion / sequence / comparison / less_equal.hpp
1 /*=============================================================================
2     Copyright (c) 1999-2003 Jaakko Jarvi
3     Copyright (c) 2001-2006 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_LESS_EQUAL_05052005_0432)
9 #define FUSION_LESS_EQUAL_05052005_0432
10
11 #include <boost/fusion/sequence/intrinsic/begin.hpp>
12 #include <boost/fusion/sequence/intrinsic/end.hpp>
13 #include <boost/fusion/sequence/intrinsic/size.hpp>
14 #include <boost/fusion/sequence/comparison/detail/enable_comparison.hpp>
15
16 #if defined(FUSION_DIRECT_OPERATOR_USAGE)
17 #include <boost/fusion/sequence/comparison/detail/less_equal.hpp>
18 #else
19 #include <boost/fusion/sequence/comparison/less.hpp>
20 #endif
21
22 namespace boost { namespace fusion
23 {
24     template <typename Seq1, typename Seq2>
25     inline bool
26     less_equal(Seq1 const& a, Seq2 const& b)
27     {
28 #if defined(FUSION_DIRECT_OPERATOR_USAGE)
29         return detail::sequence_less_equal<Seq1 const, Seq2 const>::
30             call(fusion::begin(a), fusion::begin(b));
31 #else
32         return !(b < a);
33 #endif
34     }
35
36     namespace operators
37     {
38 #if defined(BOOST_MSVC) && (BOOST_MSVC <= 1400) 
39 // Workaround for  VC8.0 and VC7.1
40         template <typename Seq1, typename Seq2>
41         inline bool
42         operator<=(sequence_base<Seq1> const& a, sequence_base<Seq2> const& b)
43         {
44             return less_equal(a.derived(), b.derived());
45         }
46
47         template <typename Seq1, typename Seq2>
48         inline typename disable_if<detail::is_native_fusion_sequence<Seq2>, bool>::type
49         operator<=(sequence_base<Seq1> const& a, Seq2 const& b)
50         {
51             return less_equal(a.derived(), b);
52         }
53
54         template <typename Seq1, typename Seq2>
55         inline typename disable_if<detail::is_native_fusion_sequence<Seq1>, bool>::type
56         operator<=(Seq1 const& a, sequence_base<Seq2> const& b)
57         {
58             return less_equal(a, b.derived());
59         }
60
61 #else
62 // Somehow VC8.0 and VC7.1 does not like this code
63 // but barfs somewhere else. 
64
65         template <typename Seq1, typename Seq2>
66         inline typename
67             enable_if<
68                 detail::enable_comparison<Seq1, Seq2>
69               , bool
70             >::type
71         operator<=(Seq1 const& a, Seq2 const& b)
72         {
73             return fusion::less_equal(a, b);
74         }
75 #endif
76     }
77     using operators::operator<=;
78 }}
79
80 #endif