iterator_range_equality_bug.cpp 948 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. // Boost.Range library
  2. //
  3. // Copyright Neil Groves 2014. Use, modification and
  4. // distribution is subject to the Boost Software License, Version
  5. // 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  6. // http://www.boost.org/LICENSE_1_0.txt)
  7. //
  8. //
  9. // For more information, see http://www.boost.org/libs/range/
  10. //
  11. // As reported in https://groups.google.com/forum/#!msg/boost-developers-archive/6JVNg7ZPb4k/RAlvPUec4MAJ
  12. #include <boost/range/iterator_range_core.hpp>
  13. #include <boost/lambda/lambda.hpp>
  14. #include <boost/algorithm/string.hpp>
  15. namespace boost
  16. {
  17. enum {unnamed};
  18. struct S {
  19. bool operator<(int) const {return false;}
  20. bool operator==(int) const {return false;}
  21. };
  22. template<typename T>
  23. bool foo(T i)
  24. {
  25. return i < unnamed || i == unnamed;
  26. }
  27. }
  28. int main()
  29. {
  30. using boost::lambda::_1;
  31. (void)(_1 == 42);
  32. (void)(42 == _1);
  33. boost::foo(42);
  34. boost::foo(boost::S());
  35. }