|
Boost : |
From: Gavin Lambert (boost_at_[hidden])
Date: 2021-10-20 23:22:40
On 21/10/2021 11:19, Bjorn Reese wrote:
> There is another option that should be considered.
>
> Given that string views are cheap to copy, we could create an
> intermediary string view class that has all the implicit conversions
> and nothing else. The sole purpose of this, say, string_mediator is to
> convert between std::string_view and boost::string_view.
>
> This string_mediator becomes the interoperability type, and no change
> is needed to either std::string_view nor boost::string_view.
> Furthermore, no implicit conversions are needed in boost::string_view.
>
> If you want your API to support implicit conversion, then you should
> use string_mediator in your API.
Yes, that's what I suggested elsewhere (as boost::any_string_view).
It does have some drawbacks (it can't be used directly as an rvalue, you
need to cast or assign it to a "real" string_view type first).
I don't think Peter likes that option since his goal seems to be to
replace string_view entirely. (Which I'm not inherently opposed to; I
just think it's not being done the right way.)
It's not as good as updating the existing boost::string_view but that
option also seems to be off the table for whatever reason.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk