iterator.hpp 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // (C) Copyright David Abrahams 2002.
  2. // Distributed under the Boost Software License, Version 1.0. (See
  3. // accompanying file LICENSE_1_0.txt or copy at
  4. // http://www.boost.org/LICENSE_1_0.txt)
  5. #ifndef ITERATOR_DWA122600_HPP_
  6. #define ITERATOR_DWA122600_HPP_
  7. // This header is obsolete and will be deprecated.
  8. #include <iterator>
  9. #if defined(__SUNPRO_CC) && (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION))
  10. #include <cstddef>
  11. #endif
  12. namespace boost
  13. {
  14. namespace detail
  15. {
  16. using std::iterator_traits;
  17. using std::distance;
  18. #if defined(__SUNPRO_CC) && (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION))
  19. // std::distance from stlport with Oracle compiler 12.4 and 12.5 fails to deduce template parameters
  20. // when one of the arguments is an array and the other one is a pointer.
  21. template< typename T, std::size_t N >
  22. inline typename std::iterator_traits< T* >::difference_type distance(T (&left)[N], T* right)
  23. {
  24. return std::distance(static_cast< T* >(left), right);
  25. }
  26. #endif
  27. } // namespace detail
  28. } // namespace boost
  29. #endif // ITERATOR_DWA122600_HPP_