28 Nov
2019
28 Nov
'19
3:36 p.m.
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.