This is the mail archive of the libstdc++@sourceware.cygnus.com mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: basic_string<>::max_size - only 1MB?


Ryszard Kabatek wrote:
> 
> BTW. Must the value of npos be size_type(-1) ?
>
Yes, the standard requires the following declaration:

> namespace std {
>     template<class charT,
>              class traits = char_traits<charT>,
>              class Allocator = allocator<charT> >
>     class basic_string {
>       public:
>         typedef typename Allocator::size_type size_type;
>         ...
>         static const size_type npos = -1;
>         ...
>     };
> }

This wasn't a very well decision because it causes a LOT of trouble.


-- 
Nicolai M. Josuttis
Solutions in Time

http://www.josuttis.de/
mailto:solutions@josuttis.de

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]