set.hpp 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /* Boost interval/compare/set.hpp template implementation file
  2. *
  3. * Copyright 2002-2003 Guillaume Melquiond
  4. *
  5. * Distributed under the Boost Software License, Version 1.0.
  6. * (See accompanying file LICENSE_1_0.txt or
  7. * copy at http://www.boost.org/LICENSE_1_0.txt)
  8. */
  9. #ifndef BOOST_NUMERIC_INTERVAL_COMPARE_SET_HPP
  10. #define BOOST_NUMERIC_INTERVAL_COMPARE_SET_HPP
  11. #include <boost/numeric/interval/detail/interval_prototype.hpp>
  12. #include <boost/numeric/interval/detail/test_input.hpp>
  13. #include <boost/numeric/interval/utility.hpp>
  14. namespace boost {
  15. namespace numeric {
  16. namespace interval_lib {
  17. namespace compare {
  18. namespace set {
  19. template<class T, class Policies1, class Policies2> inline
  20. bool operator<(const interval<T, Policies1>& x, const interval<T, Policies2>& y)
  21. {
  22. return proper_subset(x, y);
  23. }
  24. template<class T, class Policies> inline
  25. bool operator<(const interval<T, Policies>& , const T& )
  26. {
  27. throw comparison_error();
  28. }
  29. template<class T, class Policies1, class Policies2> inline
  30. bool operator<=(const interval<T, Policies1>& x, const interval<T, Policies2>& y)
  31. {
  32. return subset(x, y);
  33. }
  34. template<class T, class Policies> inline
  35. bool operator<=(const interval<T, Policies>& , const T& )
  36. {
  37. throw comparison_error();
  38. }
  39. template<class T, class Policies1, class Policies2> inline
  40. bool operator>(const interval<T, Policies1>& x, const interval<T, Policies2>& y)
  41. {
  42. return proper_subset(y, x);
  43. }
  44. template<class T, class Policies> inline
  45. bool operator>(const interval<T, Policies>& , const T& )
  46. {
  47. throw comparison_error();
  48. }
  49. template<class T, class Policies1, class Policies2> inline
  50. bool operator>=(const interval<T, Policies1>& x, const interval<T, Policies2>& y)
  51. {
  52. return subset(y, x);
  53. }
  54. template<class T, class Policies> inline
  55. bool operator>=(const interval<T, Policies>& , const T& )
  56. {
  57. throw comparison_error();
  58. }
  59. template<class T, class Policies1, class Policies2> inline
  60. bool operator==(const interval<T, Policies1>& x, const interval<T, Policies2>& y)
  61. {
  62. return equal(y, x);
  63. }
  64. template<class T, class Policies> inline
  65. bool operator==(const interval<T, Policies>& , const T& )
  66. {
  67. throw comparison_error();
  68. }
  69. template<class T, class Policies1, class Policies2> inline
  70. bool operator!=(const interval<T, Policies1>& x, const interval<T, Policies2>& y)
  71. {
  72. return !equal(y, x);
  73. }
  74. template<class T, class Policies> inline
  75. bool operator!=(const interval<T, Policies>& , const T& )
  76. {
  77. throw comparison_error();
  78. }
  79. } // namespace set
  80. } // namespace compare
  81. } // namespace interval_lib
  82. } // namespace numeric
  83. } // namespace boost
  84. #endif // BOOST_NUMERIC_INTERVAL_COMPARE_SET_HPP