This is the mail archive of the
mailing list for the libstdc++ project.
COW strings in libstdc++
- From: Brendan Miller <catphive at catphive dot net>
- To: libstdc++ at gcc dot gnu dot org
- Date: Mon, 31 Aug 2009 10:44:29 -0700
- Subject: COW strings in libstdc++
It looks like the current implementation of string in libstdc++ is
copy on write correct? Is this also true of gcc 3.4? Is this behavior
guaranteed for the future, or will C++0x somehow require a change
Generally I'm wondering whether it will remain efficient to do things
like stick strings by value in vectors to be sorted. Right now as I
see it, there's no real point in wrapping the string in a shared_ptr,
since it already uses reference counting internally.
Does C++0x effect the complexity specification of std::string in such
a way that COW strings are required or prohibited, i.e. is operator=
supposed to be constant time now?