I was reading the documentation for std::string_view
, and I noticed that these were the constructors:
constexpr basic_string_view() noexcept;
constexpr basic_string_view(const basic_string_view& other) noexcept = default;
constexpr basic_string_view(const CharT* s, size_type count);
constexpr basic_string_view(const CharT* s);
Why didn't they introduced this one?
template<std::size_t n>
constexpr basic_string_view(const CharT(&s)[n]) : basic_string_view(s, n) {}
In the majority of cases, it would save a call to strlen()
. Is there a reason it hasn't been introduced?