mirror of
https://github.com/boostorg/core.git
synced 2025-07-29 12:27:42 +02:00
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).
This commit is contained in:
@ -9,6 +9,9 @@
|
||||
// This header is obsolete and will be deprecated.
|
||||
|
||||
#include <iterator>
|
||||
#if defined(__SUNPRO_CC) && (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION))
|
||||
#include <cstddef>
|
||||
#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
|
||||
|
Reference in New Issue
Block a user