Boost logo

Boost :

Subject: Re: [boost] [String Algo] error in ireplace_first or ireplace_all with std::wstring under gcc 3.4.2 (MingW)
From: Pavol Droba (droba_at_[hidden])
Date: 2010-01-20 18:10:47


On 20. 1. 2010 22:54, Brian Ravnsgaard Riis wrote:
> On 20-01-2010 18:41, Doug Swanson wrote:
>> Thank you so much for your reply! I really appreciate it.
>>
>> Although I remember reading about this issue at some point in the past,
>> I have used std::wstring under MingW-gcc for quite some time now with no
>> problems. If it were really 100% incompatible I would wish it would
>> give a compilation error! I wonder why it crashes under the 'ireplace'
>> algorithms but not the 'replace' ones -- especially since I remain
>> strictly within Unicode Plane 0 (basic 2-byte characters in UTF-16/UCS-2
>> which fit in a single wchar_t on Windows).
>>
>> In any event, if you have any further insight here I would be interested
>> to hear it, but I suppose I will just have to change compilers. Thanks
>> again!
>>
>
> [snip]
>
>>> As far as I know, that answer is quite simple. Unless something have
>>> changed recently, mingw does not support unicode strings. I would
>>> suggest to swith to non-mingw version of gcc.
>
> How goes the difference between replace and ireplace? IIUC MinGW itself
> is as fully wide-aware as any other gcc, it's libstdc++ which is not
> under MinGW. Using MinGW with another standard library (STLPort for
> instance) should make your problems go away.
>
> However, since only one of the two algorithms fail, I wonder at their
> implementation. Does ireplace use some part of the standard library that
> replace does not?
>

Difference is quite clear. The second one is using std::locale. If the standard
library is broken, it could explain the behaviour

Regards,
Pavol.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk