[prev in list] [next in list] [prev in thread] [next in thread] 

List:       boost
Subject:    Re: [boost] Fixed String review
From:       Peter Dimov via Boost <boost () lists ! boost ! org>
Date:       2019-11-28 15:36:33
Message-ID: D5149537DDE74C5BB9AA77B96C572504 () pdimov5
[Download RAW message or body]

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. 


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic