From: Kim G. <kim...@gm...> - 2010-10-20 18:41:15
|
Hi Dean, On Wed, Oct 20, 2010 at 14:39, Dean Michael Berris <mik...@gm...> wrote: >> >> >> I'm unconvinced that COW strings can be depended on as a central >> library feature- a quick Google seems to indicate otherwise. >> >> http://bit.ly/hiqqU >> http://bit.ly/cqpKVN >> > > cpp-netlib doesn't depend on COW, but most implementations do > implement std::string with COW optimizations. This means, GNU's > libstdc++ has a COW string, Dinkumware (now Microsoft's STL) > implements it as well. Worrying about copies only matters if it's > really affecting the performance of the application. Microsoft's STL as of VS2008 doesn't use COW, it uses the small-string optimization. Not sure if they went (back?) to COW in 2010, but I doubt it. LLVM has an interesting sub-project implementing a standard library from scratch, and one of the decisions they mention in the overview is using small string optimization over COW, as if it was a plain truth; http://libcxx.llvm.org/. So, I think there's merit to not expecting COW from std::string. - Kim |