OUString is mutable?

Caolán McNamara caolanm at redhat.com
Fri Sep 28 07:00:16 PDT 2012


On Fri, 2012-09-28 at 14:17 +0200, Noel Grandin wrote:
> you can do this:
> 
>      void f(OUString s) {
>           s = "2";
>      }
> 
>      OUString s = "1";
>      f(s);
>      cout << s; // will print "2"

That will print "1" not "2".

Maybe you meant

void f(OUString& s) {
  s = "2"; 
} 

OUString s = "1";
f(s);
cout << s; // will print "2"

but that's perfectly reasonable.

C.



More information about the LibreOffice mailing list