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