fixed GH #1425: Workaround bug in SolarisStudio 12.4 on RVO-ed objects.

This commit is contained in:
Günter Obiltschnig 2017-11-08 15:00:44 +01:00
parent 079c9a6263
commit 47043e0f4f

View File

@ -386,7 +386,7 @@ S translate(const S& str, const typename S::value_type* from, const typename S::
template <class S>
S& translateInPlace(S& str, const S& from, const S& to)
/// Replaces in str all occurences of characters in from
/// Replaces in str all occurrences of characters in from
/// with the corresponding (by position) characters in to.
/// If there is no corresponding character, the character
/// is removed.
@ -402,7 +402,13 @@ S translateInPlace(S& str, const typename S::value_type* from, const typename S:
poco_check_ptr (from);
poco_check_ptr (to);
str = translate(str, S(from), S(to));
#if defined(__SUNPRO_CC)
// Fix around the RVO bug in SunStudio 12.4
S ret(str);
return ret;
#else
return str;
#endif
}
@ -489,7 +495,7 @@ S& removeInPlace(S& str, const typename S::value_type ch, typename S::size_type
template <class S>
S replace(const S& str, const S& from, const S& to, typename S::size_type start = 0)
/// Replace all occurences of from (which must not be the empty string)
/// Replace all occurrences of from (which must not be the empty string)
/// in str with to, starting at position start.
{
S result(str);