   Using strings, and making string functions
  Hi, I want to know if the string types that have been created for c++ are any good. Like that one that comes with the ''std'' or something like that ::String.Like are they efficient, do they use dynamic arrays on the inside or something?Ive thought about creating my own string class using vectors , so i can have the right array size.Also Ive noticed so far that there nearly no functions that return strings in c++. Like ive also heard people saying not to for some reason.But it can be really useful if you do return strings, like in java you have the getString() or getText() functions that return Strings allowing you to easily output integer/float values etc.So basically my questions are:*are the provided string types efficient?*is it ok to return strings in functions? why/whynot*if string types arnt efficient, should i just create my own class with vectors?Thankyou, 
quote:Original post by johnnyBravo  *are the provided string types efficient?Yes.quote:*is it ok to return strings in functions? why/whynotIt''s okay. Just be aware that doing so involves copying ths string, which can be inefficient. It''s not a property/problem of strings alone; anytime you return by value you have this creep up. One alternative is to pass in the return variable by reference, but it can get ugly...quote:*if string types arnt efficient, should i just create my own class with vectors?Strings are efficient, don''t create your own (except as a learning exercise). ;quote:Original post by Oluseyi   It's okay. Just be aware that doing so involves copying ths string, which can be inefficient. It's not a property/problem of strings alone; anytime you return by value you have this creep up. One alternative is to pass in the return variable by reference, but it can get ugly...Another alternative is to measure the `efficiency loss'. If you detect a loss that really bothers you, buy a decent compiler that knows how to perform RVO. [edited by - SabreMan on February 13, 2004 7:16:21 PM];  alternatively, use a library that does copy-on-write sharing of the string data... 