" ▁class ▁but ▁this ▁makes ▁it ▁complex ▁▁ ▁arbitrary _ code _ here (); ▁// ▁no ▁optim izations ▁can ▁fix ▁this ▁▁ ▁* pointer ▁= ▁' b '; ▁// ▁if ▁operator [] ▁did ▁not ▁copy , ▁this ▁would ▁change ▁original ▁unexpected ly ▁ ▁This ▁caused ▁some ▁implementations ▁to ▁abandon ▁copy - on - write . ▁It ▁was ▁also ▁discovered ▁that ▁the ▁overhead ▁in ▁multi - thread ed ▁applications ▁due ▁to ▁the ▁lock ing ▁needed ▁to ▁examine ▁or ▁change ▁the ▁reference ▁count ▁was ▁greater ▁than ▁the ▁overhead ▁of ▁copying ▁small ▁strings ▁on ▁modern ▁process ors ▁( es pecially ▁for ▁strings ▁smaller ▁than ▁the ▁size ▁of ▁a ▁pointer ). ▁The ▁optimization ▁was ▁finally ▁dis allowed ▁in ▁C ++ 1 1 , ▁with ▁the ▁result ▁that ▁even ▁passing ▁a ▁ ▁as ▁an ▁argument ▁to ▁a ▁function , ▁viz . ▁ ▁void ▁print ( std :: string ▁s ) ▁{ ▁std :: cout ▁<< ▁s ; ▁} ▁ ▁must ▁be ▁expected ▁to ▁perform ▁a ▁full ▁copy ▁of ▁the ▁string ▁into ▁newly ▁allocated ▁memory . ▁The ▁common ▁id iom ▁to ▁avoid ▁such ▁copying ▁is ▁to ▁pass ▁as ▁a ▁const ▁reference : ▁ ▁void ▁print ( const ▁std :: string & ▁s ) ▁{ ▁std :: cout ▁<< ▁s ; ▁} ▁ ▁In ▁C ++ 1 7 ▁added ▁a ▁new ▁ ▁class ▁that ▁is ▁only ▁a ▁pointer ▁and ▁length ▁to ▁read - only ▁data , ▁makes ▁passing ▁arguments ▁far ▁faster ▁than ▁either ▁of ▁the ▁above ▁examples : ▁ ▁void ▁print ( std :: string _ view ▁s ) ▁{