[string.view.cons] (original) (raw)

27 Strings library [strings]

27.3 String view classes [string.view]

27.3.3 Class template basic_string_view [string.view.template]

27.3.3.2 Construction and assignment [string.view.cons]

constexpr basic_string_view() noexcept;

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

constexpr basic_string_view(const charT* str);

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

Effects: Constructs a basic_string_view, initializing data_ with strand initializing size_ with traits​::​length(str).

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

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

Effects: Constructs a basic_string_view, initializing data_ with strand initializing size_ with len.

template<class It, class End> constexpr basic_string_view(It begin, End end);

Constraints:

Preconditions:

Effects: Initializes data_ with to_address(begin) and initializes size_ with end - begin.

Throws: When and what end - begin throws.

template<class R> constexpr explicit basic_string_view(R&& r);

Let d be an lvalue of type remove_cvref_t<R>.

Constraints:

Effects: Initializes data_ with ranges​::​data(r) andsize_ with ranges​::​size(r).

Throws: Any exception thrown by ranges​::​data(r) and ranges​::​size(r).