string in c++ is implemented in copy-on-write (COW) way, assign new bolck of mem until you edit