What is the currently way to use string?

S

Steven Lien

I have a Tree like data structure and each node stores a "string" to
represent a word that the node represent..

and since i do need to print out string from each node, using following
method

string s = node.getWord();
cout << s.c_str();

the assignment (=) will be very inefficient since it copied a new copy to
print....

so my question is

what is the most popular method to deal with string?....to allocate memeory
using "new" or using copying assignment?


Any help will be appreciated...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,139
Messages
2,570,805
Members
47,351
Latest member
LolaD32479

Latest Threads

Top