From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2019-11-29 00:18:11
On 2019-11-29 01:44, Zach Laine via Boost wrote:
> Ok, I understand your point a bit better now I think. Is it the
> unboundedly-large nature of a NTBS that has you concerned? That is, do you
> think that op+=(char) should assert and op+=(char const *) should throw?
> That position makes sense to me, thought I don't share it -- though I think
> that's just taste. However, I cannot imagine why I'd ever want op+=(char)
> or op+=(string_view) to throw.
IIRC, append/insert/push_back will throw with any container or
std::string, if the result exceeds max_size(). It is only natural if
fixed_string does the same, it is the expected behavior.
You can argue for a separate set of unsafe insert methods that don't
perform the check and exhibit undefined behavior if the resulting length
exceeds the limit. But it should be very clear that the user must ensure
himself that it doesn't happen.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk