std::string and literals
Jack Reeves
jackw_reeves@hotmail.com
Fri Jul 19 08:56:00 GMT 2002
>Q. Is there a way to specifically create a std::string instance that will
>just be a reference to the given literal? (with copy on write semantics
>of course).
>
No. a 'string' is an object and naturally manages its own state.
In my private tool box I have a class called basic_stringref
(with the obvious typedef basic_stringref<char> stringref).
It does what you want - wraps a 'string' facade around an
existing character array without making a copy. Of course,
it is not a 'string' and so can not be passed to a function that
expects one. If you are interested in more details email me directly.
Jack
_________________________________________________________________
MSN Photos is the easiest way to share and print your photos:
http://photos.msn.com/support/worldwide.aspx
More information about the Libstdc++
mailing list