??????? ??????? (but it was actually Dmitry Arkhipov) wrote:
чт, 8 февр. 2024 г. в 19:11, Andrey Semashev via Boost
: Template interface parity is useful in cases like this:
https://github.com/boostorg/container/blob/6e697d796897b32b471b4f074 0d
caa03d8ee57cc/include/boost/container/string.hpp#L685-L691
https://github.com/boostorg/container/blob/6e697d796897b32b471b4f074 0d
caa03d8ee57cc/include/boost/container/string.hpp#L2314-L2316
std::basic_string instead uses this check:
This overload participates in overload resolution only if std::is_convertible_v
> is true and std::is_convertible_v is false.
I prefer to detect StringLike types by checking for T::value_type, T::traits_type, T::data() and T::size(). That's almost what the range constructor of std::string_view does, except the check for T::traits_type was not introduced there because the constructor was made explicit instead.