Boost logo

Boost :

From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2021-10-18 01:00:37


On 10/18/21 3:49 AM, Peter Dimov via Boost wrote:
> Andrey Semashev wrote:
>> Making your libraries explicitly support std::string_view, in addition to
>> boost::string_view, is one option. I realize this is more work for you as the
>> maintainer, but this is a valid solution nonetheless.
>
> Remember that libraries also need to return string_views.

Yes. Depending on the case, this can be worked around too. For example,
have a convention that if you accept a string_view, you return the same
kind of string_view as well. If you don't accept a string_view, let the
user choose what he wants. Pick a default, if that's too verbose.

And in case you're worried about linking compatibility, that's not a
problem if you maintain your ABI properly. Have all this configurable
stuff in the headers and keep your core neutral to the C++ version and
config choices. Gladly, the conversion between string_views is cheap.

I'm not saying it's perfect, but it sounds doable.


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