/Src/Dependencies/Boost/boost/fusion/sequence/comparison/less_equal.hpp

http://hadesmem.googlecode.com/ · C++ Header · 81 lines · 62 code · 9 blank · 10 comment · 1 complexity · dad4ab06debe38e25312ff9c2337d6d6 MD5 · raw file

  1. /*=============================================================================
  2. Copyright (c) 1999-2003 Jaakko Jarvi
  3. Copyright (c) 2001-2006 Joel de Guzman
  4. Distributed under the Boost Software License, Version 1.0. (See accompanying
  5. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. ==============================================================================*/
  7. #if !defined(FUSION_LESS_EQUAL_05052005_0432)
  8. #define FUSION_LESS_EQUAL_05052005_0432
  9. #include <boost/fusion/sequence/intrinsic/begin.hpp>
  10. #include <boost/fusion/sequence/intrinsic/end.hpp>
  11. #include <boost/fusion/sequence/intrinsic/size.hpp>
  12. #include <boost/fusion/sequence/comparison/enable_comparison.hpp>
  13. #include <boost/fusion/support/is_sequence.hpp>
  14. #if defined(FUSION_DIRECT_OPERATOR_USAGE)
  15. #include <boost/fusion/sequence/comparison/detail/less_equal.hpp>
  16. #else
  17. #include <boost/fusion/sequence/comparison/less.hpp>
  18. #endif
  19. namespace boost { namespace fusion
  20. {
  21. template <typename Seq1, typename Seq2>
  22. inline bool
  23. less_equal(Seq1 const& a, Seq2 const& b)
  24. {
  25. #if defined(FUSION_DIRECT_OPERATOR_USAGE)
  26. return detail::sequence_less_equal<Seq1 const, Seq2 const>::
  27. call(fusion::begin(a), fusion::begin(b));
  28. #else
  29. return !(b < a);
  30. #endif
  31. }
  32. namespace operators
  33. {
  34. #if defined(BOOST_MSVC) && (BOOST_MSVC <= 1400)
  35. // Workaround for VC8.0 and VC7.1
  36. template <typename Seq1, typename Seq2>
  37. inline bool
  38. operator<=(sequence_base<Seq1> const& a, sequence_base<Seq2> const& b)
  39. {
  40. return less_equal(a.derived(), b.derived());
  41. }
  42. template <typename Seq1, typename Seq2>
  43. inline typename disable_if<traits::is_native_fusion_sequence<Seq2>, bool>::type
  44. operator<=(sequence_base<Seq1> const& a, Seq2 const& b)
  45. {
  46. return less_equal(a.derived(), b);
  47. }
  48. template <typename Seq1, typename Seq2>
  49. inline typename disable_if<traits::is_native_fusion_sequence<Seq1>, bool>::type
  50. operator<=(Seq1 const& a, sequence_base<Seq2> const& b)
  51. {
  52. return less_equal(a, b.derived());
  53. }
  54. #else
  55. // Somehow VC8.0 and VC7.1 does not like this code
  56. // but barfs somewhere else.
  57. template <typename Seq1, typename Seq2>
  58. inline typename
  59. enable_if<
  60. traits::enable_comparison<Seq1, Seq2>
  61. , bool
  62. >::type
  63. operator<=(Seq1 const& a, Seq2 const& b)
  64. {
  65. return fusion::less_equal(a, b);
  66. }
  67. #endif
  68. }
  69. using operators::operator<=;
  70. }}
  71. #endif