-
August 5th, 2010, 04:02 AM
#31
Re: A question regarding *s++
Originally Posted by itsmeandnobodyelse
Really? You can't safely derive from it, can you? You can't add new member functions therefore, right?
Enhancements via function templates hardly can be used for praising a class design. On the contrary, they are global functions and I share the opinion that global functions mostly is poor OOP and the need for those functions show the heavy shortcomings of this class.
Heh, when you stated that "the basic_string class actually is a poor string class", I actually thought that you had its over-abundance of member functions in mind. Apparently not. Read:
-
August 5th, 2010, 06:46 AM
#32
Re: A question regarding *s++
Originally Posted by itsmeandnobodyelse
Really? You can't safely derive from it, can you? You can't add new member functions therefore, right?
Enhancements via function templates hardly can be used for praising a class design.
Not class design specifically----but architecture design as a whole, absolutely. The STL concept of separating containers from algorithms (except where an algorithm is specific to a container type, like std::list::sort) is brilliant, frankly. The idea that you can write an algorithm without having to care what type it operates on was a revelation when I first worked through the implications.
Last edited by Lindley; August 5th, 2010 at 06:49 AM.
-
August 5th, 2010, 10:23 AM
#33
Re: A question regarding *s++
Originally Posted by itsmeandnobodyelse
Even my very first string class in the early 90's had better functionality and the missing 'trim'
Huge string classes that try to do everything under the sun and try to be all things to most people is one of the complaints given to std::string -- it is not considered a virtue to pack in all of these functions that are easily done using algorithms. All a string class should do IMO is to do concatenation, copy safely, and get substrings.
Or take the case where you need to convert from wstring to string or vice versa or let alone character encoding like UTF-8 to ANSI and back. It is not alone that the basic_string doesn't give any concepts for this, it adds additional complexity to those conversions whenever different char types are involved.
That's why you have the std::transform algorithm -- I use it now to convert between different string types.
Regards,
Paul McKenzie
Last edited by Paul McKenzie; August 5th, 2010 at 10:28 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|