[string.accessors] (original) (raw)
27 Strings library [strings]
27.4 String classes [string.classes]
27.4.3 Class template basic_string [basic.string]
27.4.3.8 String operations [string.ops]
27.4.3.8.1 Accessors [string.accessors]
constexpr const charT* c_str() const noexcept;constexpr const charT* data() const noexcept;
Returns: A pointer p such that p + i == addressof(operator[](i)) for eachi in [0, size()].
Complexity: Constant time.
Remarks: The program shall not modify any of the values stored in the character array; otherwise, the behavior is undefined.
constexpr charT* data() noexcept;
Returns: A pointer p such that p + i == addressof(operator[](i)) for eachi in [0, size()].
Complexity: Constant time.
Remarks: The program shall not modify the value stored at p + size()to any value other than charT(); otherwise, the behavior is undefined.
constexpr operator basic_string_view<charT, traits>() const noexcept;
Effects: Equivalent to:return basic_string_view<charT, traits>(data(), size());
constexpr allocator_type get_allocator() const noexcept;
Returns: A copy of theAllocatorobject used to construct the string or, if that allocator has been replaced, a copy of the most recent replacement.