workaround.hpp 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. // (C) Copyright Gennadiy Rozental 2005-2008.
  2. // Distributed under the Boost Software License, Version 1.0.
  3. // (See accompanying file LICENSE_1_0.txt or copy at
  4. // http://www.boost.org/LICENSE_1_0.txt)
  5. // See http://www.boost.org/libs/test for the library home page.
  6. //
  7. // File : $RCSfile$
  8. //
  9. // Version : $Revision: 54633 $
  10. //
  11. // Description : contains mics. workarounds
  12. // ***************************************************************************
  13. #ifndef BOOST_TEST_WORKAROUND_HPP_021005GER
  14. #define BOOST_TEST_WORKAROUND_HPP_021005GER
  15. // Boost
  16. #include <boost/config.hpp> // compilers workarounds and std::ptrdiff_t
  17. // STL
  18. #include <iterator> // for std::distance
  19. #include <boost/test/detail/suppress_warnings.hpp>
  20. //____________________________________________________________________________//
  21. namespace boost {
  22. namespace unit_test {
  23. namespace ut_detail {
  24. #ifdef BOOST_NO_STD_DISTANCE
  25. template <class T>
  26. std::ptrdiff_t distance( T const& x_, T const& y_ )
  27. {
  28. std::ptrdiff_t res = 0;
  29. std::distance( x_, y_, res );
  30. return res;
  31. }
  32. //____________________________________________________________________________//
  33. #else
  34. using std::distance;
  35. #endif
  36. template <class T> inline void ignore_unused_variable_warning(const T&) {}
  37. } // namespace ut_detail
  38. } // namespace unit_test
  39. namespace unit_test_framework = unit_test;
  40. } // namespace boost
  41. //____________________________________________________________________________//
  42. #include <boost/test/detail/enable_warnings.hpp>
  43. #endif // BOOST_TEST_WORKAROUND_HPP_021005GER