[patch] std::string::operator[] extension in debug mode

chris jefferson caj@cs.york.ac.uk
Fri May 20 07:46:00 GMT 2005


Jonathan Wakely wrote:

>On Thu, May 19, 2005 at 07:13:27PM +0200, Gabriel Dos Reis wrote:
>
>  
>
>>Douglas Gregor <doug.gregor@gmail.com> writes:
>>
>>
>>[...]
>>
>>| does the right thing. We might also want to mark operator[] with the
>>| "always_inline" attribute,
>>
>>Ahem, no.
>>
>>| so that we never get two conflicting definitions of the same code.
>>
>>If the names are properly reroutedm we should not get that confilt.
>>    
>>
>
>For std::string we don't provide a separate __gnu_norm::basic_string and
>a __gnu_debug::basic_string, we just add some assertions to
>std::basic_string if debug mode is enabled.
>
>This means the names are identical, but the instantiation in the lib
>does not have the assertions, while the implicit instantiation in the
>user's objects has the assertions - i.e. genuine ODR.
>
>  
>
Sorry for a possibly stupid question. but this seems to me to be the 
main problem. Will the problems go away if we just have two definitions 
of basic_string, like we have two definitions of other containers for 
when we want debug mode?

Chris



More information about the Libstdc++ mailing list