OUString is mutable?
Noel Grandin
noel at peralex.com
Fri Sep 28 08:00:37 PDT 2012
On 2012-09-28 16:46, Norbert Thiebaud wrote:
> On Fri, Sep 28, 2012 at 9:05 AM, Noel Grandin <noel at peralex.com> wrote:
>> If you tell me that the saving from not having the nCapacity field is the
>> motivation, then I get understand, but then we should update the docs to
>> reflect that fact, rather than pretending that OUString is immutable.
> >From what I gathered: the thing pointed to by OUString _is_ immutable
> but you can make a OUString point to another 'immutable content'.
> iow it is not OUString that is immutable... but it's 'payload'.
>
> I may be wrong, but I assume that the reason OUString is like that is
> not just to save a nCapacity... but also because there are assumption
> you can make if that property is true (that OUString only point to
> immutable data, regarding memory allocation, copy, clone etc...
>
>
If that's the case, then we could steal a bit somewhere to indicate that
the payload is immutable, and have all of those optimisations without
needing to create a whole separate OUStringBuffer class.
Disclaimer: http://www.peralex.com/disclaimer.html
More information about the LibreOffice
mailing list