
Klemens Morgenstern wrote:
https://source.chromium.org/chromium/chromium/src/+/main:base/strings/cstrin...
I would like an extended signature of this https://source.chromium.org/chromium/chromium/src/+/main:base/strings/ cstring_view.h;l=121
from `same_as<basic_string<char>>` to `string_like` :
template<typename T> concept string_like = requires (const T & t) { {t.size()} -> std::convertible_to<std::size_t>; {t.data()} -> std::same_as<const T::value_type *>; {t.c_str()} -> std::same_as<const T::value_type *>; };
Which would mean that `foo(cstring_view)` can be called with a `boost::urls::url` for example. In my mind this would reflect the behaviour of std::string_view that accepts anything with a datat() && size() function.
It doesn't quite. In C++23, it accepts any contiguous sized range (meaning that it also needs begin and end returning a contiguous iterator, not just data and size.) This was a controversial (and wrong, in my opinion) addition that was pushed through and had later to be corrected because it caused obvious issues. https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2516r0.html