From: pete@versatilecoding.com   
      
   On 2012-03-29 19:13:08 +0000, Seungbeom Kim said:   
      
   > On 2012-03-28 21:24, Nikolay Ivchenkov wrote:   
   >> On 28 Mar, 23:13, Daniel Krügler    
   >> wrote:   
   >>> A valid implementation could e.g. use the same constant char object   
   >>> as a common null character for all empty strings.   
   >>   
   >> Yes, I thought about such implementation, but I can't imagine any   
   >> problems with non-empty strings. Probably, the intention was to keep   
   >> the rules simple (even though they imply unnecessary restriction).   
   >   
   > In addition, 'c_str() const' should return an array that terminates with   
   > a null character (charT()), and 'operator[](size_type pos) const' should   
   > return charT() for pos == size(). Therefore, I think an implementation   
   > that doesn't keep a null character at the end is making things difficult   
   > for itself for no good reason I can see. (Let me know if there are some.)   
      
   As far as I know, you're right. This was all designed back in the early   
   days of standardization. There was a great deal of paranoia about the   
   possibility of overconstraining implementations. In hindsight, this is   
   rather silly.   
      
   --   
    Pete   
   Roundhouse Consulting, Ltd. (www.versatilecoding.com) Author of "The   
   Standard C++ Library Extensions: a Tutorial and Reference   
   (www.petebecker.com/tr1book)   
      
      
    [ See http://www.gotw.ca/resources/clcm.htm for info about ]   
    [ comp.lang.c++.moderated. First time posters: Do this! ]   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|