24 Strings library [strings]

24.4 String view classes [string.view]

24.4.2 Class template basic_­string_­view [string.view.template]

24.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 64.

Table 64basic_­string_­view(const charT*) effects
ElementValue
data_­ str
size_­ traits​::​length(str)

Complexity: O(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 65.

Table 65basic_­string_­view(const charT*, size_­type) effects
ElementValue
data_­ str
size_­ len