Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2019-11-28 15:36:33


Vinnie Falco wrote:
> Okay, I agree that we need to do _something_. I'm not sure exactly what
> that something is. I'm hesitant to endorse operator+ because of the
> unpredictable behavior. How about a free function `concat(...)` which
> allows the caller to optionally specify the maximum capacity of the
> resulting string,

The function that allows you to specify the capacity is spelled

    fixed_string<N> result = s1 + s2;

This is not particularly efficient on paper, it's one extra memcpy, but
that's unavoidable when using op+.

And, while I agree that op+ giving 1024 for two 512 inputs isn't very
useful, op+ for inputs 12 and 8 giving 20 seems not that useless.


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