<cm****@hotmail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
I am going to implement a new string class for my os, do you have
any idea to enhance of standard c++ string class?
If compare c++ string class with CS++ CString class and java String
class, what is your opinion?
thanks
Same advice as Alipha: best is to just use std::string
(assuming a complete C++ toolchain exists for "your os").
If you see a reason not to do so, please discuss it here.
Strings are an over-researched topic. The string class
defined by the C++ Standard only has two weaknesses IMO,
and they probably aren't what you would think:
1) std::string has too many member functions
There is no end to the number of functions/transforms one
may want to apply to std::string. The right way to deal
with the situation is to implement only essential operations
as member functions, and all the rest as 'free' functions.
Most C++ experts agree that too much has already been
included as members of std::string.
(yes, other string classes have done worse...)
2) there could be a place for a non-mutable string
If the characters of an std::string instance were not
modifiable (as is the case in Java), some optimizations
could be applied. Some library writers question whether
having only a non-mutable string, or both std::const_string
and std::string, would be better that the current situation.
hth -Ivan
--
http://ivan.vecerina.com/contact/?subject=NG_POST <- email contact form