Browsing twitter I found this example of C++23 code.
This is my adaptation of it, to make more obvious what I am interested about(I do not care about dangling problems mentioned in replies).
#include <vector>
#include <string_view>
#include <iostream>
#include <type_traits>
int main() {
std::vector v{84.72};
std::basic_string_view sv = v;
static_assert(std::is_same_v<decltype(sv), std::basic_string_view<double>>);
const auto val = *std::begin(sv);
std::cout << val;
}
My question is why isn't there some requires/concept constraint on the basic_string_view to make it work only with charish types, so basic_string_view<double> in this example would not compile?