A question regarding *s++ - Page 3
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 3 of 3 FirstFirst 123
Results 31 to 33 of 33

Thread: A question regarding *s++

  1. #31
    Join Date
    Jan 2006
    Location
    Singapore
    Posts
    6,250

    Re: A question regarding *s++

    Quote 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:
    C + C++ Compiler: MinGW port of GCC
    Build + Version Control System: SCons + Bazaar

    Look up a C/C++ Reference and learn How To Ask Questions The Smart Way
    Kindly rate my posts if you found them useful

  2. #32
    Lindley is offline Elite Member Power Poster
    Join Date
    Oct 2007
    Location
    Fairfax, VA
    Posts
    10,888

    Re: A question regarding *s++

    Quote Originally Posted by itsmeandnobodyelse View Post
    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.

  3. #33
    Join Date
    Apr 1999
    Posts
    27,423

    Re: A question regarding *s++

    Quote Originally Posted by itsmeandnobodyelse View Post
    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.

Page 3 of 3 FirstFirst 123

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center