[v3] libstdc++/16612

Benjamin Kosnik bkoz@redhat.com
Sat Sep 25 01:38:00 GMT 2004


>Frankly, I cannot support this kind of approach:
>
>*************** namespace std
>*** 614,620 ****
>        operator[] (size_type __pos) const
>        {
>      _GLIBCXX_DEBUG_ASSERT(__pos <= size());
>!     return _M_data()[__pos];
>        }
> 
>        /**
>--- 621,631 ----
>        operator[] (size_type __pos) const
>        {
>      _GLIBCXX_DEBUG_ASSERT(__pos <= size());
>!     _CharT* __p = _M_data();
>!     if (__p)
>!       return __p[__pos];
>!     else
>!       return _Rep::_S_terminal;
>        }
>
>Having a conditional for the most fundamental operation, that is
>character access, doesn't seem a price that can be paid in order to
>easily support shared memory.

Have any other ideas? Other than partial specializations of std::string
I'm fresh out. If you look through bugzilla, there seem to be two
approaches: the one outlined here and the mock-up in p.10040721-3.
Honestly, I think this one is better.

Right now I think this plus partial specialization is the best approach.

Thoughts?

-benjamin



More information about the Libstdc++ mailing list