On Tuesday 19 January 2016 10:07:43 Marc Mutz wrote: > > That doesn't mean types without CoW are immune from the problem. There are > > lots of discussion in the std mailing lists about constexpr data, so in > > the > > future a const std::string could potentially point to .rodata and thus be > > affected by this problem too. > > But only _locally_. As soon as you copy the std::string, you're insulated > from that problem, unlike in CoW, where it can strike anywhere the string > happens to be copied to.
I am not sure. This is of course speculative since such code does not exist. But it's entirely possible that std::string's move constructor could propagate the reference to that .rodata. std::string someString() { return constexpr_string("foo"); } std::string g_string; void f() { // move-construction static std::string s_string = someString(); // causes move-assignment operator to be called g_string = someString(); } Also, people using deep-copy types tend to keep references more often than people using cheap CoW types. -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel Open Source Technology Center _______________________________________________ Development mailing list Development@qt-project.org http://lists.qt-project.org/mailman/listinfo/development