According to the documentation, std::string_view has a constructor that takes a const char *
and a std::size_t
, that is not declared noexcept
:
constexpr basic_string_view(const CharT* s, size_type count);
On the other hand, the documentation states also that the user defined literal operator""sv
, that in all the implementations I've seen is a simple wrapper to that constructor, is declared noexcept
:
constexpr std::string_view operator "" sv(const char* str, std::size_t len) noexcept;
Do you know the reason of this difference? When is that the constuctor can throw?