From d7324129246e8a0d501d375d1b74c4cd9bb9355f Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Mon, 11 Jul 2016 16:34:02 +0300 Subject: [PATCH] Added a workaround for Oracle compiler with STLport when the first argument to distance() is an array and the second one is a pointer (presumably, pointing into the array). --- include/boost/detail/iterator.hpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/include/boost/detail/iterator.hpp b/include/boost/detail/iterator.hpp index c2e8f1e..ad75e6a 100644 --- a/include/boost/detail/iterator.hpp +++ b/include/boost/detail/iterator.hpp @@ -9,6 +9,9 @@ // This header is obsolete and will be deprecated. #include +#if defined(__SUNPRO_CC) && (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) +#include +#endif namespace boost { @@ -19,6 +22,16 @@ namespace detail using std::iterator_traits; using std::distance; +#if defined(__SUNPRO_CC) && (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) +// std::distance from stlport with Oracle compiler 12.4 and 12.5 fails to deduce template parameters +// when one of the arguments is an array and the other one is a pointer. +template< typename T, std::size_t N, typename U > +inline typename std::iterator_traits< T* >::difference_type distance(T (&left)[N], U* right) +{ + return std::distance(static_cast< T* >(left), right); +} +#endif + } // namespace detail } // namespace boost