Boost logo

Boost :

From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2019-12-05 13:04:10


On 2019-12-05 15:26, Andrzej Krzemienski via Boost wrote:
>
> I think that this discussion diverges from the point of this thread. It was
> not about operator[] (for which it is clear that passing a too big index is
> a bug) but about resizing over fixed_string's capacity, in which case the
> library doesn't make it clear if it is even a bug, or something that the
> programmer may want to do.
>
> For instance, in std::sting it is not a bug to resize over the capacity,
> and fixed_string is supposed to be a drop-in replacement.
>
> I would like to make this question sorted out first; and only then can we
> decide what to put inside the function.

It is not so much about exceeding the capacity() but about exceeding
max_size(). In fixed_string, capacity() happens to be equal to
max_size() upon construction.

Exceeding max_size() in std::string and containers is diagnosed with an
exception, and IMO fixed_string should follow.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk