|
Boost : |
From: Reece Dunn (msclrhd_at_[hidden])
Date: 2004-05-26 15:24:15
John Nagle wrote:
> Since space for a trailing null is required, the
>minimum "capacity" is currently 1.
>
> The maximum value for "size()" is then "capacity()-1".
>That seems a little wierd. Should the trailing null be
>counted in "capacity?"
This is a good point. At the moment fixed_string< n >::capacity() == n. It
would therefore make sense that this be changed so that either:
[1] fixed_string< n >::capacity() == n - 1 -- this would seem
counter-intuitive, as fixed_string< 1 > would not be able to store any
characters!
[2] change CharT str[ n ] to CharT str[ n + 1 ] -- i.e. add an extra
character for the trailing null. This would make more sense, as it is
similar to:
char * str = new char[ s.length() + 1 ];
I personally but a vote for solution 2, but what do other people think?
Regards,
Reece
_________________________________________________________________
It's fast, it's easy and it's free. Get MSN Messenger today!
http://www.msn.co.uk/messenger
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk