Ice 3.7 C++11 API Reference
Iterator.h
Go to the documentation of this file.
1 //
2 // Copyright (c) ZeroC, Inc. All rights reserved.
3 //
4 
5 #ifndef ICE_UTIL_ITERATOR_H
6 #define ICE_UTIL_ITERATOR_H
7 
8 #include <iterator>
9 
10 namespace IceUtilInternal
11 {
12 
13 template<class ForwardIterator>
14 inline typename ForwardIterator::difference_type
15 distance(ForwardIterator first, ForwardIterator last)
16 {
17 //
18 // Work-around for a limitation in the standard library provided
19 // with the Sun C++ 5.x compilers
20 #if defined(__SUNPRO_CC) && defined(_RWSTD_NO_CLASS_PARTIAL_SPEC)
21 
22  ForwardIterator::difference_type result = 0;
23  std::distance(first, last, result);
24  return result;
25 #else
26  return ::std::distance(first, last);
27 #endif
28 }
29 
30 }
31 #endif