Skip to content

Commit 56c0401

Browse files
committed
Fixed compilation with Sun Studio 12 (avoid usage of std::distance)
1 parent a1d6c9e commit 56c0401

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

src/lib_json/json_valueiterator.inl

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,18 @@ ValueIteratorBase::computeDistance( const SelfType &other ) const
9797
{
9898
return 0;
9999
}
100-
return difference_type( std::distance( current_, other.current_ ) );
100+
101+
102+
// Usage of std::distance is not portable (does not compile with Sun Studio 12 RogueWave STL,
103+
// which is the one used by default).
104+
// Using a portable hand-made version for non random iterator instead:
105+
// return difference_type( std::distance( current_, other.current_ ) );
106+
difference_type myDistance = 0;
107+
for ( Value::ObjectValues::iterator it = current_; it != other.current_; ++it )
108+
{
109+
++myDistance;
110+
}
111+
return myDistance;
101112
# endif
102113
#else
103114
if ( isArray_ )

0 commit comments

Comments
 (0)