home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.c++.moderated      Moderated discussion of C++ superhackery      33,346 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 32,066 of 33,346   
   Seungbeom Kim to Nikolay Ivchenkov   
   Re: Modification of trailing null charac   
   29 Mar 12 20:49:19   
   
   4fb27f0e   
   From: musiphil@bawi.org   
      
   On 2012-03-29 14:05, Nikolay Ivchenkov wrote:   
   > On 29 Mar, 23:13, Seungbeom Kim  wrote:   
   >> 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.   
   >   
   > Such implementations of basic_string are disallowed under C++11 rules   
   > - see 21.4.7.1/1.   
      
   Thank you for the information.   
      
   21.4.7.1[string.accessors]/1 defines 'c_str() const noexcept' and   
   'data() const noexcept' in exactly the same way: they return a pointer p   
   such that p + i == &operator[](i) for each i in [0,size()].   
      
   21.4.5[string.access]/2 defines both 'operator[](size_type pos) const'   
   and 'operator[](size_type pos)' to return a reference to an object of   
   type T with value charT(), which shall not be modified, for pos == size().   
      
   On the other hand, I guess assigning charT() to an object which already   
   has charT() still qualifies as modification.   
      
   --   
   Seungbeom Kim   
      
      
         [ 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)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca