While I like programming in C++, I hate the idea of:std::basic_string
vs
QString
vs
wxString
vs .............
Doesn't the standard string
class satisfy the needs for these frameworks? I mean what is wrong with the standard string
class?!
Just to emphasize, that below is the important question:
Do you learn "the" string class of the framework in every framework you are going to work with? would you instead stick to the standard string class by trying to adapt it everywhere?
Thanks...
String in Java is slower when modified as compared to the StringBuffer class. C++ string class in STL are slower in implementation than Strings declared using character array. Strings are faster in implementations as compared to the String class of C++. Memory allocation is static as strings are immutable.
Java String class provides a lot of methods to perform operations on strings such as compare(), concat(), equals(), split(), length(), replace(), compareTo(), intern(), substring() etc. The java.lang.String class implements Serializable, Comparable and CharSequence interfaces.
The String class represents character strings. All string literals in Java programs, such as "abc" , are implemented as instances of this class. Strings are constant; their values cannot be changed after they are created.
A string is not a data type but a class in System namespace in C# i.e., System. String and string is an alias (another name) of the same.
The reason for multiple string classes is that the C++ standard was finalized fairly late (in 1998); it then took some time until all systems actually provided a correct C++ library. By that time, all these competing string classes where already written.
In addition, in some cases, people want to inherit from a single base class, which std::string wouldn't do.
IMO, std::string isn't old enough to be widespread (Qt and wxWidgets are older than the STL, or at least older than widely available stable and working STLs). Also, std::string is sadly not the best string class there is for everyone, and other frameworks have other needs.
Note! The paragraph below slightly incorrect, but kept to make sense of comments.
For instance, C++ STL's is very resource constrained, whereas the Qt string class offer lots of goodies that a committe would never agree on, especially as some want it to be easily implementable on embedded systems and the like.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With