21 Strings library [strings]

21.4 String view classes [string.view]

21.4.2 Class template basic_string_view [string.view.template]

21.4.2.1 Construction and assignment [string.view.cons]

constexpr basic_string_view() noexcept;

Effects: Constructs an empty basic_string_view.

Postconditions: size_ == 0 and data_ == nullptr.

constexpr basic_string_view(const charT* str);

Requires: [str, str + traits::length(str)) is a valid range.

Effects: Constructs a basic_string_view, with the postconditions in Table [tab:string.view.ctr.2].

Table 64basic_string_view(const charT*) effects
ElementValue
data_ str
size_ traits::length(str)

Complexity: Ο(traits::length(str)).

constexpr basic_string_view(const charT* str, size_type len);

Requires: [str, str + len) is a valid range.

Effects: Constructs a basic_string_view, with the postconditions in Table [tab:string.view.ctr.3].

Table 65basic_string_view(const charT*, size_type) effects
ElementValue
data_ str
size_ len