Are you sure? From basic_string.h:

        _CharT*
        _M_refcopy() throw()
        {
#ifndef _GLIBCXX_FULLY_DYNAMIC_STRING
          if (__builtin_expect(this != &_S_empty_rep(), false))
#endif
__gnu_cxx::__atomic_add_dispatch(&this->_M_refcount, 1);
          return _M_refdata();
        }  // XXX MT

 COW is just an implementation detail of GCC's crappy string.

Microsoft string for instance, does not do COW, it uses a 15 byte SBO. And you can also just replace it with your own string type(EASTL)

Reply via email to