workaround.hpp 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. // (C) Copyright Gennadiy Rozental 2001.
  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
  8. //!@brief contains mics. workarounds
  9. // ***************************************************************************
  10. #ifndef BOOST_TEST_WORKAROUND_HPP_021005GER
  11. #define BOOST_TEST_WORKAROUND_HPP_021005GER
  12. // Boost
  13. #include <boost/config.hpp> // compilers workarounds and std::ptrdiff_t
  14. // STL
  15. #include <iterator> // for std::distance
  16. #include <boost/test/detail/suppress_warnings.hpp>
  17. //____________________________________________________________________________//
  18. namespace boost {
  19. namespace unit_test {
  20. namespace ut_detail {
  21. #ifdef BOOST_NO_STD_DISTANCE
  22. template <class T>
  23. std::ptrdiff_t distance( T const& x_, T const& y_ )
  24. {
  25. std::ptrdiff_t res = 0;
  26. std::distance( x_, y_, res );
  27. return res;
  28. }
  29. //____________________________________________________________________________//
  30. #else
  31. using std::distance;
  32. #endif
  33. template <class T> inline void ignore_unused_variable_warning(const T&) {}
  34. } // namespace ut_detail
  35. } // namespace unit_test
  36. } // namespace boost
  37. //____________________________________________________________________________//
  38. #include <boost/test/detail/enable_warnings.hpp>
  39. #endif // BOOST_TEST_WORKAROUND_HPP_021005GER