▁std :: cout ▁<< ▁s ; ▁} ▁... ▁▁ ▁std :: string ▁x ▁= ▁... ; ▁▁ ▁print ( x ); ▁// ▁does ▁not ▁copy ▁x . data () ▁▁ ▁print (" this ▁is ▁a ▁literal ▁string "); ▁// ▁also ▁does ▁not ▁copy ▁the ▁characters ! ▁... ▁ ▁Example ▁usage ▁ ▁# include ▁< iostream > ▁# include ▁< string > ▁int ▁main () ▁{ ▁▁▁▁ ▁std :: string ▁foo (" fig h ters "); ▁▁▁▁ ▁std :: string ▁bar (" st ool "); ▁▁▁▁ ▁if ▁( foo ▁!= ▁bar ) ▁▁▁▁▁▁▁▁ ▁std :: cout ▁<< ▁" The ▁strings ▁are ▁different ." ▁<< ▁std :: endl ; ▁▁▁▁ ▁std :: cout ▁<< ▁" String ▁= ▁" ▁<< ▁bar ▁<< ▁std :: endl ; ▁▁▁▁ ▁return ▁ 0 ; ▁} ▁ ▁Rel ated ▁classes ▁▁▁ ▁is ▁a ▁typedef ▁for ▁a ▁particular ▁instanti ation ▁of ▁the ▁ ▁template ▁class . ▁Its ▁definition ▁is ▁found ▁in ▁the ▁ ▁header : ▁ ▁typedef ▁basic _ string < char > ▁string ; ▁ ▁Thus ▁ ▁provides ▁ ▁functionality ▁for ▁strings ▁having ▁elements ▁of ▁type ▁. ▁There ▁is ▁a ▁similar ▁class ▁, ▁which ▁consists ▁of ▁, ▁and ▁is ▁most ▁often ▁used ▁to ▁store ▁UTF - 1 6 ▁text ▁on ▁Windows ▁and ▁UTF - 3 2 ▁on ▁most ▁Unix - like ▁platforms . ▁The ▁C ++ ▁standard , ▁however , ▁does ▁not ▁imp ose ▁any ▁interpretation ▁as ▁Unicode ▁code ▁points ▁or ▁code ▁units ▁on ▁these ▁types ▁and ▁does ▁not ▁even ▁guarantee ▁that ▁a ▁ ▁holds ▁more ▁bits ▁than ▁a ▁.