Files
2025-10-25 03:02:53 +03:00

5.1 KiB
Raw Permalink Blame History

[string.view.cons]

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;

1

#

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

🔗

constexpr basic_string_view(const charT* str);

2

#

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

3

#

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

4

#

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

🔗

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

5

#

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

6

#

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

🔗

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

7

#

Constraints:

8

#

Preconditions:

9

#

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

10

#

Throws: When and what end - begin throws.

🔗

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

11

#

Let d be an lvalue of type remove_cvref_t.

12

#

Constraints:

remove_cvref_t is not the same type as basic_string_view,

R modelsranges::contiguous_range and ranges::sized_range,

is_same_v<ranges::range_value_t, charT> is true,

is_convertible_v<R, const charT*> is false, and

d.operator ::std::basic_string_view<charT, traits>() is not a valid expression.

13

#

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

14

#

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