BDE 4.14.0 Production release
|
#include <bslstl_string.h>
Public Types | |
typedef CHAR_TRAITS | traits_type |
typedef CHAR_TRAITS::char_type | value_type |
typedef ALLOCATOR | allocator_type |
typedef AllocatorTraits::size_type | size_type |
typedef AllocatorTraits::difference_type | difference_type |
typedef AllocatorTraits::pointer | pointer |
typedef AllocatorTraits::const_pointer | const_pointer |
typedef value_type & | reference |
typedef const value_type & | const_reference |
typedef CHAR_TYPE * | iterator |
typedef const CHAR_TYPE * | const_iterator |
typedef bsl::reverse_iterator< iterator > | reverse_iterator |
typedef bsl::reverse_iterator< const_iterator > | const_reverse_iterator |
These types satisfy the ReversibleSequence requirements. | |
Public Member Functions | |
BSLMF_NESTED_TRAIT_DECLARATION_IF (basic_string, BloombergLP::bslmf::IsBitwiseMoveable, BloombergLP::bslmf::IsBitwiseMoveable< ALLOCATOR >::value) | |
basic_string () BSLS_KEYWORD_NOEXCEPT | |
basic_string (const ALLOCATOR &basicAllocator) BSLS_KEYWORD_NOEXCEPT | |
basic_string (const basic_string &original) | |
basic_string (const basic_string &original, const ALLOCATOR &basicAllocator) | |
basic_string (BloombergLP::bslmf::MovableRef< basic_string > original) BSLS_KEYWORD_NOEXCEPT | |
basic_string (BloombergLP::bslmf::MovableRef< basic_string > original, const ALLOCATOR &basicAllocator) | |
basic_string (const basic_string &original, size_type position, const ALLOCATOR &basicAllocator=ALLOCATOR()) | |
basic_string (const basic_string &original, size_type position, size_type numChars, const ALLOCATOR &basicAllocator=ALLOCATOR()) | |
basic_string (const CHAR_TYPE *characterString, const ALLOCATOR &basicAllocator=ALLOCATOR()) | |
basic_string (const CHAR_TYPE *characterString, size_type numChars, const ALLOCATOR &basicAllocator=ALLOCATOR()) | |
basic_string (size_type numChars, CHAR_TYPE character, const ALLOCATOR &basicAllocator=ALLOCATOR()) | |
template<class INPUT_ITER > | |
basic_string (INPUT_ITER first, INPUT_ITER last, const ALLOCATOR &basicAllocator=ALLOCATOR()) | |
template<class ALLOC2 > | |
basic_string (const std::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOC2 > &original, const ALLOCATOR &basicAllocator=ALLOCATOR()) | |
basic_string (const BloombergLP::bslstl::StringRefData< CHAR_TYPE > &strRef, const ALLOCATOR &basicAllocator=ALLOCATOR()) | |
template<class STRING_VIEW_LIKE_TYPE > | |
basic_string (const STRING_VIEW_LIKE_TYPE &object BSLSTL_STRING_DECLARE_ONLY_CONVERTIBLE_TO_STRINGVIEW_PARAM_ALLOC) | |
template<class STRING_VIEW_LIKE_TYPE > | |
basic_string (const STRING_VIEW_LIKE_TYPE &object, size_type position, size_type numChars, const ALLOCATOR &basicAllocator=ALLOCATOR() BSLSTL_STRING_DECLARE_CONVERTIBLE_TO_STRINGVIEW_PARAM_VOID) | |
~basic_string () | |
Destroy this string object. | |
basic_string & | operator= (const basic_string &rhs) |
template<class STRING_VIEW_LIKE_TYPE > | |
BSLSTL_STRING_DEFINE_ONLY_CONVERTIBLE_TO_STRINGVIEW_RETURN_TYPE | operator= (const STRING_VIEW_LIKE_TYPE &rhs) |
basic_string & | operator= (const CHAR_TYPE *rhs) |
basic_string & | operator= (CHAR_TYPE character) |
template<class ALLOC2 > | |
basic_string & | operator= (const std::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOC2 > &rhs) |
void | resize (size_type newLength, CHAR_TYPE character) |
void | resize (size_type newLength) |
template<class OPERATION > | |
void | resize_and_overwrite (size_type newLength, OPERATION operation) |
void | reserve (size_type newCapacity=0) |
void | shrink_to_fit () |
void | clear () BSLS_KEYWORD_NOEXCEPT |
iterator | begin () BSLS_KEYWORD_NOEXCEPT |
iterator | end () BSLS_KEYWORD_NOEXCEPT |
Return the past-the-end iterator for this modifiable string. | |
reverse_iterator | rbegin () BSLS_KEYWORD_NOEXCEPT |
reverse_iterator | rend () BSLS_KEYWORD_NOEXCEPT |
Return the past-the-end reverse iterator for this modifiable string. | |
reference | operator[] (size_type position) |
reference | at (size_type position) |
CHAR_TYPE & | front () |
CHAR_TYPE & | back () |
basic_string & | operator+= (const basic_string &rhs) |
basic_string & | operator+= (const CHAR_TYPE *rhs) |
basic_string & | operator+= (CHAR_TYPE character) |
template<class STRING_VIEW_LIKE_TYPE > | |
BSLSTL_STRING_DEFINE_ONLY_CONVERTIBLE_TO_STRINGVIEW_RETURN_TYPE | operator+= (const STRING_VIEW_LIKE_TYPE &rhs) |
template<class ALLOC2 > | |
basic_string & | operator+= (const std::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOC2 > &rhs) |
basic_string & | append (const basic_string &suffix) |
basic_string & | append (const basic_string &suffix, size_type position, size_type numChars=npos) |
basic_string & | append (const CHAR_TYPE *characterString, size_type numChars) |
basic_string & | append (const CHAR_TYPE *characterString) |
basic_string & | append (size_type numChars, CHAR_TYPE character) |
template<class STRING_VIEW_LIKE_TYPE > | |
BSLSTL_STRING_DEFINE_ONLY_CONVERTIBLE_TO_STRINGVIEW_RETURN_TYPE | append (const STRING_VIEW_LIKE_TYPE &suffix) |
template<class STRING_VIEW_LIKE_TYPE > | |
BSLSTL_STRING_DEFINE_ONLY_CONVERTIBLE_TO_STRINGVIEW_RETURN_TYPE | append (const STRING_VIEW_LIKE_TYPE &suffix, size_type position, size_type numChars=npos) |
template<class INPUT_ITER > | |
basic_string & | append (INPUT_ITER first, INPUT_ITER last) |
void | push_back (CHAR_TYPE character) |
Append the specified character to this string. | |
basic_string & | assign (const basic_string &replacement) |
basic_string & | assign (BloombergLP::bslmf::MovableRef< basic_string > replacement) BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(false) |
basic_string & | assign (const basic_string &replacement, size_type position, size_type numChars=npos) |
basic_string & | assign (const CHAR_TYPE *characterString) |
basic_string & | assign (const CHAR_TYPE *characterString, size_type numChars) |
template<class STRING_VIEW_LIKE_TYPE > | |
BSLSTL_STRING_DEFINE_ONLY_CONVERTIBLE_TO_STRINGVIEW_RETURN_TYPE | assign (const STRING_VIEW_LIKE_TYPE &replacement) |
template<class STRING_VIEW_LIKE_TYPE > | |
BSLSTL_STRING_DEFINE_ONLY_CONVERTIBLE_TO_STRINGVIEW_RETURN_TYPE | assign (const STRING_VIEW_LIKE_TYPE &replacement, size_type position, size_type numChars=npos) |
template<class ALLOC2 > | |
basic_string & | assign (const std::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOC2 > &string) |
basic_string & | assign (size_type numChars, CHAR_TYPE character) |
template<class INPUT_ITER > | |
basic_string & | assign (INPUT_ITER first, INPUT_ITER last) |
basic_string & | insert (size_type position, const basic_string &other) |
basic_string & | insert (size_type position, const basic_string &other, size_type sourcePosition, size_type numChars=npos) |
basic_string & | insert (size_type position, const CHAR_TYPE *characterString, size_type numChars) |
basic_string & | insert (size_type position, const CHAR_TYPE *characterString) |
basic_string & | insert (size_type position, size_type numChars, CHAR_TYPE character) |
iterator | insert (const_iterator position, CHAR_TYPE character) |
template<class INPUT_ITER > | |
iterator | insert (const_iterator position, INPUT_ITER first, INPUT_ITER last) |
iterator | insert (const_iterator position, size_type numChars, CHAR_TYPE character) |
template<class STRING_VIEW_LIKE_TYPE > | |
BSLSTL_STRING_DEFINE_ONLY_CONVERTIBLE_TO_STRINGVIEW_RETURN_TYPE | insert (size_type position, const STRING_VIEW_LIKE_TYPE &other) |
template<class STRING_VIEW_LIKE_TYPE > | |
BSLSTL_STRING_DEFINE_ONLY_CONVERTIBLE_TO_STRINGVIEW_RETURN_TYPE | insert (size_type position, const STRING_VIEW_LIKE_TYPE &other, size_type sourcePosition, size_type numChars=npos) |
basic_string & | erase (size_type position=0, size_type numChars=npos) |
iterator | erase (const_iterator position) |
iterator | erase (const_iterator first, const_iterator last) |
void | pop_back () |
basic_string & | replace (size_type outPosition, size_type outNumChars, const basic_string &replacement) |
basic_string & | replace (size_type outPosition, size_type outNumChars, const basic_string &replacement, size_type position, size_type numChars=npos) |
basic_string & | replace (size_type outPosition, size_type outNumChars, const CHAR_TYPE *characterString, size_type numChars) |
basic_string & | replace (size_type outPosition, size_type outNumChars, const CHAR_TYPE *characterString) |
basic_string & | replace (size_type outPosition, size_type outNumChars, size_type numChars, CHAR_TYPE character) |
template<class STRING_VIEW_LIKE_TYPE > | |
BSLSTL_STRING_DEFINE_ONLY_CONVERTIBLE_TO_STRINGVIEW_RETURN_TYPE | replace (size_type outPosition, size_type outNumChars, const STRING_VIEW_LIKE_TYPE &replacement) |
template<class STRING_VIEW_LIKE_TYPE > | |
BSLSTL_STRING_DEFINE_ONLY_CONVERTIBLE_TO_STRINGVIEW_RETURN_TYPE | replace (size_type outPosition, size_type outNumChars, const STRING_VIEW_LIKE_TYPE &replacement, size_type position, size_type numChars=npos) |
basic_string & | replace (const_iterator first, const_iterator last, const basic_string &replacement) |
template<class STRING_VIEW_LIKE_TYPE > | |
BSLSTL_STRING_DEFINE_ONLY_CONVERTIBLE_TO_STRINGVIEW_RETURN_TYPE | replace (const_iterator first, const_iterator last, const STRING_VIEW_LIKE_TYPE &replacement) |
basic_string & | replace (const_iterator first, const_iterator last, const CHAR_TYPE *characterString, size_type numChars) |
basic_string & | replace (const_iterator first, const_iterator last, const CHAR_TYPE *characterString) |
basic_string & | replace (const_iterator first, const_iterator last, size_type numChars, CHAR_TYPE character) |
template<class INPUT_ITER > | |
basic_string & | replace (const_iterator first, const_iterator last, INPUT_ITER stringFirst, INPUT_ITER stringLast) |
CHAR_TYPE * | data () BSLS_KEYWORD_NOEXCEPT |
const_iterator | cbegin () const BSLS_KEYWORD_NOEXCEPT |
const_iterator | end () const BSLS_KEYWORD_NOEXCEPT |
const_iterator | cend () const BSLS_KEYWORD_NOEXCEPT |
Return the past-the-end iterator for this string. | |
const_reverse_iterator | rbegin () const BSLS_KEYWORD_NOEXCEPT |
const_reverse_iterator | crbegin () const BSLS_KEYWORD_NOEXCEPT |
const_reverse_iterator | rend () const BSLS_KEYWORD_NOEXCEPT |
const_reverse_iterator | crend () const BSLS_KEYWORD_NOEXCEPT |
Return the past-the-end reverse iterator for this string. | |
size_type | length () const BSLS_KEYWORD_NOEXCEPT |
size_type | size () const BSLS_KEYWORD_NOEXCEPT |
size_type | max_size () const BSLS_KEYWORD_NOEXCEPT |
size_type | capacity () const BSLS_KEYWORD_NOEXCEPT |
bool | empty () const BSLS_KEYWORD_NOEXCEPT |
Return true if this string has length 0, and false otherwise. | |
const_reference | operator[] (size_type position) const |
const_reference | at (size_type position) const |
const CHAR_TYPE & | front () const |
const CHAR_TYPE & | back () const |
size_type | copy (CHAR_TYPE *characterString, size_type numChars, size_type position=0) const |
const CHAR_TYPE * | c_str () const BSLS_KEYWORD_NOEXCEPT |
const CHAR_TYPE * | data () const BSLS_KEYWORD_NOEXCEPT |
allocator_type | get_allocator () const BSLS_KEYWORD_NOEXCEPT |
Return the allocator used by this string to supply memory. | |
size_type | find (const basic_string &substring, size_type position=0) const BSLS_KEYWORD_NOEXCEPT |
template<class STRING_VIEW_LIKE_TYPE > | |
size_type | find (const STRING_VIEW_LIKE_TYPE &substring, size_type position=0 BSLSTL_STRING_DECLARE_ONLY_CONVERTIBLE_TO_STRINGVIEW_PARAM_VOID) const BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(true) |
size_type | find (const CHAR_TYPE *substring, size_type position, size_type numChars) const |
size_type | find (const CHAR_TYPE *substring, size_type position=0) const |
size_type | find (CHAR_TYPE character, size_type position=0) const |
size_type | rfind (const basic_string &substring, size_type position=npos) const BSLS_KEYWORD_NOEXCEPT |
template<class STRING_VIEW_LIKE_TYPE > | |
size_type | rfind (const STRING_VIEW_LIKE_TYPE &substring, size_type position=npos BSLSTL_STRING_DECLARE_ONLY_CONVERTIBLE_TO_STRINGVIEW_PARAM_VOID) const BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(true) |
size_type | rfind (const CHAR_TYPE *characterString, size_type position, size_type numChars) const |
size_type | rfind (const CHAR_TYPE *characterString, size_type position=npos) const |
size_type | rfind (CHAR_TYPE character, size_type position=npos) const |
size_type | find_first_of (const basic_string &characterString, size_type position=0) const BSLS_KEYWORD_NOEXCEPT |
template<class STRING_VIEW_LIKE_TYPE > | |
size_type | find_first_of (const STRING_VIEW_LIKE_TYPE &characterString, size_type position=0 BSLSTL_STRING_DECLARE_ONLY_CONVERTIBLE_TO_STRINGVIEW_PARAM_VOID) const BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(true) |
size_type | find_first_of (const CHAR_TYPE *characterString, size_type position, size_type numChars) const |
size_type | find_first_of (const CHAR_TYPE *characterString, size_type position=0) const |
size_type | find_first_of (CHAR_TYPE character, size_type position=0) const |
size_type | find_last_of (const basic_string &characterString, size_type position=npos) const BSLS_KEYWORD_NOEXCEPT |
template<class STRING_VIEW_LIKE_TYPE > | |
size_type | find_last_of (const STRING_VIEW_LIKE_TYPE &characterString, size_type position=npos BSLSTL_STRING_DECLARE_ONLY_CONVERTIBLE_TO_STRINGVIEW_PARAM_VOID) const BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(true) |
size_type | find_last_of (const CHAR_TYPE *characterString, size_type position, size_type numChars) const |
size_type | find_last_of (const CHAR_TYPE *characterString, size_type position=npos) const |
size_type | find_last_of (CHAR_TYPE character, size_type position=npos) const |
size_type | find_first_not_of (const basic_string &characterString, size_type position=0) const BSLS_KEYWORD_NOEXCEPT |
template<class STRING_VIEW_LIKE_TYPE > | |
size_type | find_first_not_of (const STRING_VIEW_LIKE_TYPE &characterString, size_type position=0 BSLSTL_STRING_DECLARE_ONLY_CONVERTIBLE_TO_STRINGVIEW_PARAM_VOID) const BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(true) |
size_type | find_first_not_of (const CHAR_TYPE *characterString, size_type position, size_type numChars) const |
size_type | find_first_not_of (const CHAR_TYPE *characterString, size_type position=0) const |
size_type | find_first_not_of (CHAR_TYPE character, size_type position=0) const |
size_type | find_last_not_of (const basic_string &characterString, size_type position=npos) const BSLS_KEYWORD_NOEXCEPT |
template<class STRING_VIEW_LIKE_TYPE > | |
size_type | find_last_not_of (const STRING_VIEW_LIKE_TYPE &characterString, size_type position=npos BSLSTL_STRING_DECLARE_ONLY_CONVERTIBLE_TO_STRINGVIEW_PARAM_VOID) const BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(true) |
size_type | find_last_not_of (const CHAR_TYPE *characterString, size_type position, size_type numChars) const |
size_type | find_last_not_of (const CHAR_TYPE *characterString, size_type position=npos) const |
size_type | find_last_not_of (CHAR_TYPE character, size_type position=npos) const |
bool | starts_with (basic_string_view< CHAR_TYPE, CHAR_TRAITS > characterString) const BSLS_KEYWORD_NOEXCEPT |
bool | starts_with (CHAR_TYPE character) const BSLS_KEYWORD_NOEXCEPT |
bool | starts_with (const CHAR_TYPE *characterString) const |
bool | ends_with (basic_string_view< CHAR_TYPE, CHAR_TRAITS > characterString) const BSLS_KEYWORD_NOEXCEPT |
bool | ends_with (CHAR_TYPE character) const BSLS_KEYWORD_NOEXCEPT |
bool | ends_with (const CHAR_TYPE *characterString) const |
basic_string | substr (size_type position=0, size_type numChars=npos) const |
int | compare (const basic_string &other) const BSLS_KEYWORD_NOEXCEPT |
int | compare (size_type position, size_type numChars, const basic_string &other) const |
int | compare (size_type lhsPosition, size_type lhsNumChars, const basic_string &other, size_type otherPosition, size_type otherNumChars=npos) const |
int | compare (const CHAR_TYPE *other) const |
int | compare (size_type lhsPosition, size_type lhsNumChars, const CHAR_TYPE *other, size_type otherNumChars) const |
int | compare (size_type lhsPosition, size_type lhsNumChars, const CHAR_TYPE *other) const |
template<class STRING_VIEW_LIKE_TYPE > | |
int | compare (const STRING_VIEW_LIKE_TYPE &other BSLSTL_STRING_DECLARE_ONLY_CONVERTIBLE_TO_STRINGVIEW_PARAM_VOID) const BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(true) |
template<class STRING_VIEW_LIKE_TYPE > | |
int | compare (size_type position, size_type numChars, const STRING_VIEW_LIKE_TYPE &other BSLSTL_STRING_DECLARE_ONLY_CONVERTIBLE_TO_STRINGVIEW_PARAM_VOID) const |
template<class STRING_VIEW_LIKE_TYPE > | |
int | compare (size_type lhsPosition, size_type lhsNumChars, const STRING_VIEW_LIKE_TYPE &other, size_type otherPosition, size_type otherNumChars=npos BSLSTL_STRING_DECLARE_ONLY_CONVERTIBLE_TO_STRINGVIEW_PARAM_VOID) const |
template<class ALLOC2 > | |
operator std::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOC2 > () const | |
operator basic_string_view< CHAR_TYPE, CHAR_TRAITS > () const | |
template<class INPUT_ITER > | |
basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & | privateAppend (INPUT_ITER first, INPUT_ITER last, const char *message, std::input_iterator_tag) |
template<class INPUT_ITER > | |
basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & | privateAppend (INPUT_ITER first, INPUT_ITER last, const char *message, std::forward_iterator_tag) |
template<class INPUT_ITER > | |
basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & | privateAppend (INPUT_ITER first, INPUT_ITER last, const char *message) |
template<class INPUT_ITER > | |
basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & | privateAppendDispatch (INPUT_ITER first, INPUT_ITER last, const char *message, BloombergLP::bslmf::MatchArithmeticType, BloombergLP::bslmf::Nil) |
template<class INPUT_ITER > | |
basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & | privateAppendDispatch (INPUT_ITER first, INPUT_ITER last, const char *message, BloombergLP::bslmf::MatchAnyType, BloombergLP::bslmf::MatchAnyType) |
template<class FIRST_TYPE , class SECOND_TYPE > | |
basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & | privateAssignDispatch (FIRST_TYPE first, SECOND_TYPE second, const char *message) |
template<class INPUT_ITER > | |
basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & | privateReplaceDispatch (size_type position, size_type numChars, INPUT_ITER first, INPUT_ITER last, BloombergLP::bslmf::MatchArithmeticType, BloombergLP::bslmf::Nil) |
template<class INPUT_ITER > | |
basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & | privateReplaceDispatch (size_type position, size_type numChars, INPUT_ITER first, INPUT_ITER last, BloombergLP::bslmf::MatchAnyType, BloombergLP::bslmf::MatchAnyType) |
template<class INPUT_ITER > | |
basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & | privateReplace (size_type outPosition, size_type outNumChars, INPUT_ITER first, INPUT_ITER last, std::input_iterator_tag) |
template<class INPUT_ITER > | |
basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & | privateReplace (size_type outPosition, size_type outNumChars, INPUT_ITER first, INPUT_ITER last, std::forward_iterator_tag) |
template<class ALLOC2 > | |
BSLS_PLATFORM_AGGRESSIVE_INLINE | basic_string (const std::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOC2 > &original, const ALLOCATOR &basicAllocator) |
template<class STRING_VIEW_LIKE_TYPE > | |
basic_string (const STRING_VIEW_LIKE_TYPE &object, size_type position, size_type numChars, const ALLOCATOR &basicAllocator BSLSTL_STRING_DEFINE_CONVERTIBLE_TO_STRINGVIEW_PARAM_VOID) | |
template<class ALLOC2 > | |
BSLS_PLATFORM_AGGRESSIVE_INLINE basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & | operator= (const std::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOC2 > &rhs) |
template<class STRING_VIEW_LIKE_TYPE > | |
BSLS_PLATFORM_AGGRESSIVE_INLINE BSLSTL_STRING_DEFINE_ONLY_CONVERTIBLE_TO_STRINGVIEW_RETURN_TYPE | operator+= (const STRING_VIEW_LIKE_TYPE &rhs) |
template<class ALLOC2 > | |
BSLS_PLATFORM_AGGRESSIVE_INLINE basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & | operator+= (const std::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOC2 > &rhs) |
template<class STRING_VIEW_LIKE_TYPE > | |
BSLS_PLATFORM_AGGRESSIVE_INLINE BSLSTL_STRING_DEFINE_ONLY_CONVERTIBLE_TO_STRINGVIEW_RETURN_TYPE | append (const STRING_VIEW_LIKE_TYPE &suffix) |
template<class INPUT_ITER > | |
BSLS_PLATFORM_AGGRESSIVE_INLINE basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & | append (INPUT_ITER first, INPUT_ITER last) |
template<class STRING_VIEW_LIKE_TYPE > | |
BSLS_PLATFORM_AGGRESSIVE_INLINE BSLSTL_STRING_DEFINE_ONLY_CONVERTIBLE_TO_STRINGVIEW_RETURN_TYPE | assign (const STRING_VIEW_LIKE_TYPE &replacement) |
template<class STRING_VIEW_LIKE_TYPE > | |
BSLS_PLATFORM_AGGRESSIVE_INLINE BSLSTL_STRING_DEFINE_ONLY_CONVERTIBLE_TO_STRINGVIEW_RETURN_TYPE | assign (const STRING_VIEW_LIKE_TYPE &replacement, size_type position, size_type numChars) |
template<class ALLOC2 > | |
BSLS_PLATFORM_AGGRESSIVE_INLINE basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & | assign (const std::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOC2 > &string) |
template<class INPUT_ITER > | |
BSLS_PLATFORM_AGGRESSIVE_INLINE basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & | assign (INPUT_ITER first, INPUT_ITER last) |
template<class INPUT_ITER > | |
BSLSTL_INSERT_RETURN_TYPE | insert (const_iterator position, INPUT_ITER first, INPUT_ITER last) |
template<class INPUT_ITER > | |
basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & | replace (const_iterator first, const_iterator last, INPUT_ITER stringFirst, INPUT_ITER stringLast) |
template<class STRING_VIEW_LIKE_TYPE > | |
BSLS_PLATFORM_AGGRESSIVE_INLINE basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::size_type | find (const STRING_VIEW_LIKE_TYPE &substring, size_type position BSLSTL_STRING_DEFINE_ONLY_CONVERTIBLE_TO_STRINGVIEW_PARAM_VOID) const BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(true) |
template<class STRING_VIEW_LIKE_TYPE > | |
BSLS_PLATFORM_AGGRESSIVE_INLINE basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::size_type | rfind (const STRING_VIEW_LIKE_TYPE &substring, size_type position BSLSTL_STRING_DEFINE_ONLY_CONVERTIBLE_TO_STRINGVIEW_PARAM_VOID) const BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(true) |
template<class STRING_VIEW_LIKE_TYPE > | |
BSLS_PLATFORM_AGGRESSIVE_INLINE basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::size_type | find_first_of (const STRING_VIEW_LIKE_TYPE &characterString, size_type position BSLSTL_STRING_DEFINE_ONLY_CONVERTIBLE_TO_STRINGVIEW_PARAM_VOID) const BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(true) |
template<class STRING_VIEW_LIKE_TYPE > | |
BSLS_PLATFORM_AGGRESSIVE_INLINE basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::size_type | find_last_of (const STRING_VIEW_LIKE_TYPE &characterString, size_type position BSLSTL_STRING_DEFINE_ONLY_CONVERTIBLE_TO_STRINGVIEW_PARAM_VOID) const BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(true) |
template<class STRING_VIEW_LIKE_TYPE > | |
BSLS_PLATFORM_AGGRESSIVE_INLINE basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::size_type | find_first_not_of (const STRING_VIEW_LIKE_TYPE &characterString, size_type position BSLSTL_STRING_DEFINE_ONLY_CONVERTIBLE_TO_STRINGVIEW_PARAM_VOID) const BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(true) |
template<class STRING_VIEW_LIKE_TYPE > | |
BSLS_PLATFORM_AGGRESSIVE_INLINE basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::size_type | find_last_not_of (const STRING_VIEW_LIKE_TYPE &characterString, size_type position BSLSTL_STRING_DEFINE_ONLY_CONVERTIBLE_TO_STRINGVIEW_PARAM_VOID) const BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(true) |
template<class STRING_VIEW_LIKE_TYPE > | |
BSLS_PLATFORM_AGGRESSIVE_INLINE int | compare (const STRING_VIEW_LIKE_TYPE &other BSLSTL_STRING_DEFINE_ONLY_CONVERTIBLE_TO_STRINGVIEW_PARAM_VOID) const BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(true) |
Public Attributes | |
void swap(basic_string &other) BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(AllocatorTraits const_iterator | begin () const BSLS_KEYWORD_NOEXCEPT |
Static Public Attributes | |
static const size_type | npos = ~size_type(0) |
Friends | |
class | String_ClearProctor< basic_string > |
string | to_string (int) |
string | to_string (long) |
string | to_string (long long) |
string | to_string (unsigned) |
string | to_string (unsigned long) |
string | to_string (unsigned long long) |
This class template provides an STL-compliant string
that conforms to the bslma::Allocator
model. For the requirements of a string class, consult the second revision of the ISO/IEC 14882 Programming Language C++ (2003). Note that the (template parameter) CHAR_TYPE
must be equal to ALLOCATOR::value_type
. In addition, this implementation offers strong exception guarantees (see below), with the general rules that:
std::length_error
, andstd::out_of_range
.Circumstances where a method throws bsl::length_error
(1) are clear and not repeated in the individual function-level documentations below.
More generally, this class supports an almost complete set of in-core value semantic operations, including copy construction, assignment, equality comparison (but excluding ostream
printing since this component is below STL). A precise operational definition of when two objects have the same value can be found in the description of operator==
for the class. This class is exception neutral with full guarantee of rollback: if an exception is thrown during the invocation of a method on a pre-existing object, the object is left unchanged. In no event is memory leaked.
Note that aliasing (e.g., using all or part of an object as both source and destination) is supported in all cases in the public interface of basic_string . However, the private interface (...Raw
methods) should be assumed to be not alias-safe unless specifically noted otherwise.
typedef ALLOCATOR bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::allocator_type |
typedef const CHAR_TYPE* bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::const_iterator |
typedef AllocatorTraits::const_pointer bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::const_pointer |
typedef const value_type& bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::const_reference |
typedef bsl::reverse_iterator<const_iterator> bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::const_reverse_iterator |
typedef AllocatorTraits::difference_type bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::difference_type |
typedef CHAR_TYPE* bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::iterator |
typedef AllocatorTraits::pointer bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::pointer |
typedef value_type& bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::reference |
typedef bsl::reverse_iterator<iterator> bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::reverse_iterator |
typedef AllocatorTraits::size_type bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::size_type |
typedef CHAR_TRAITS bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::traits_type |
typedef CHAR_TRAITS::char_type bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::value_type |
|
inline |
|
inlineexplicit |
Create an empty string. Optionally specify the basicAllocator
used to supply memory. If basicAllocator
is not specified, a default-constructed allocator is used.
BSLS_PLATFORM_AGGRESSIVE_INLINE bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::basic_string | ( | const basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & | original | ) |
Create a string that has the same value as the specified original
string. Use the allocator returned by 'bsl::allocator_traits<ALLOCATOR>:: select_on_container_copy_construction(original.get_allocator())' to supply memory.
BSLS_PLATFORM_AGGRESSIVE_INLINE bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::basic_string | ( | const basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & | original, |
const ALLOCATOR & | basicAllocator | ||
) |
Create a string that has the same value as the specified original
string and uses the specified basicAllocator
to supply memory.
Note that it is important to have two copy constructors instead of a single:
When the copy constructor with the default allocator is used, xlC10 gets confused and refuses to use the return value optimization, which then causes extra allocations when returning by value in operator+
.
|
inline |
Create a string that has the same value as the specified original
string by moving (in constant time) the contents of original
to the new string. The allocator associated with original
is propagated for use in the newly-created string. original
is left in a valid but unspecified state.
|
inline |
Create a string that has the same value as the specified original
string that uses the specified basicAllocator
to supply memory. The contents of original
are moved (in constant time) to the new string if basicAllocator == original.get_allocator()
, and are copied (in linear time) using basicAllocator
otherwise. original
is left in a valid but unspecified state.
BSLS_PLATFORM_AGGRESSIVE_INLINE bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::basic_string | ( | const basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & | original, |
size_type | position, | ||
const ALLOCATOR & | basicAllocator = ALLOCATOR() |
||
) |
Create a string that has the same value as the substring starting at the specified position
in the specified original
string. Optionally specify the basicAllocator
used to supply memory. If basicAllocator
is not specified, a default-constructed allocator is used. Throw out_of_range
if position > original.length()
.
BSLS_PLATFORM_AGGRESSIVE_INLINE bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::basic_string | ( | const basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & | original, |
size_type | position, | ||
size_type | numChars, | ||
const ALLOCATOR & | basicAllocator = ALLOCATOR() |
||
) |
Create a string that has the same value as the substring of the specified numChars
length starting at the specified position
in the specified original
string. If numChars
equals npos
, then the remaining length of the string is used (i.e., numChars
is set to original.length() - position
). Optionally specify the basicAllocator
used to supply memory. If basicAllocator
is not specified, a default-constructed allocator is used. Throw out_of_range
if position > original.length()
.
BSLS_PLATFORM_AGGRESSIVE_INLINE bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::basic_string | ( | const CHAR_TYPE * | characterString, |
const ALLOCATOR & | basicAllocator = ALLOCATOR() |
||
) |
BSLS_PLATFORM_AGGRESSIVE_INLINE bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::basic_string | ( | const CHAR_TYPE * | characterString, |
size_type | numChars, | ||
const ALLOCATOR & | basicAllocator = ALLOCATOR() |
||
) |
Create a string that has the same value as the substring of the optionally specified numChars
length starting at the beginning of the specified characterString
. If numChars
is not specified, CHAR_TRAITS::length(characterString)
is used. Optionally specify the basicAllocator
used to supply memory. If basicAllocator
is not specified, a default-constructed allocator is used. Throw out_of_range
if numChars >= npos
.
BSLS_PLATFORM_AGGRESSIVE_INLINE bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::basic_string | ( | size_type | numChars, |
CHAR_TYPE | character, | ||
const ALLOCATOR & | basicAllocator = ALLOCATOR() |
||
) |
|
inline |
Create a string from the characters in the range starting at the specified first
iterator and ending right before the specified last
iterator of the (template parameter) type INPUT_ITER
. Optionally specify a basicAllocator
used to supply memory. If basicAllocator
is not specified, a default-constructed allocator is used. The behavior is undefined unless first
and last
refer to a sequence of valid values where first
is at a position at or before last
.
bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::basic_string | ( | const std::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOC2 > & | original, |
const ALLOCATOR & | basicAllocator = ALLOCATOR() |
||
) |
Create a string that has the same value as the specified original
string, where the type original
is the string type native to the compiler's library, instantiated with the same character type and traits type, but not necessarily the same allocator type. The resulting string will contain the same sequence of characters as original
. Optionally specify a basicAllocator
used to supply memory. If basicAllocator
is not specified, then a default-constructed allocator is used.
|
inline |
Create a string that has the same value as the specified strRef
string. The resulting string will contain the same sequence of characters as strRef
. Optionally specify a basicAllocator
used to supply memory. If basicAllocator
is not specified, then a default-constructed allocator is used.
|
inlineexplicit |
Create a string that has the same value as the specified object
. Optionally specify a basicAllocator
used to supply memory. If basicAllocator
is not specified, then a default-constructed allocator is used.
bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::basic_string | ( | const STRING_VIEW_LIKE_TYPE & | object, |
size_type | position, | ||
size_type | numChars, | ||
const ALLOCATOR & | basicAllocator = ALLOCATOR() BSLSTL_STRING_DECLARE_CONVERTIBLE_TO_STRINGVIEW_PARAM_VOID |
||
) |
Create a string that has the same value as the substring of the specified numChars
length starting at the specified position
in the specified object
. Optionally specify a basicAllocator
used to supply memory. If the basicAllocator
is not specified, a default-constructed allocator is used. Throw out_of_range
if position > original.object()
.
BSLS_PLATFORM_AGGRESSIVE_INLINE bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::~basic_string | ( | ) |
BSLS_PLATFORM_AGGRESSIVE_INLINE bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::basic_string | ( | const std::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOC2 > & | original, |
const ALLOCATOR & | basicAllocator | ||
) |
|
inline |
BSLS_PLATFORM_AGGRESSIVE_INLINE basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::append | ( | const basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & | suffix | ) |
Append to this string the specified suffix
, and return a reference providing modifiable access to this string.
basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::append | ( | const basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & | suffix, |
size_type | position, | ||
size_type | numChars = npos |
||
) |
Append to this string the optionally specified numChars
characters starting at the specified position
in the specified suffix
, or the tail of suffix
starting at position
if position + numChars > suffix.length()
. If numChars
is not specified, npos
is used. Return a reference providing modifiable access to this string. Throw out_of_range
if position > suffix.length()
.
BSLS_PLATFORM_AGGRESSIVE_INLINE basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::append | ( | const CHAR_TYPE * | characterString | ) |
Append the specified null-terminated characterString
(of length CHAR_TRAITS::length(characterString)
) to this string, and return a reference providing modifiable access to this string.
BSLS_PLATFORM_AGGRESSIVE_INLINE basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::append | ( | const CHAR_TYPE * | characterString, |
size_type | numChars | ||
) |
Append to this string the specified initial numChars
characters from the specified characterString
, and return a reference providing modifiable access to this string. The behavior is undefined unless characterString
is at least numChars
long.
BSLSTL_STRING_DEFINE_ONLY_CONVERTIBLE_TO_STRINGVIEW_RETURN_TYPE bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::append | ( | const STRING_VIEW_LIKE_TYPE & | suffix | ) |
Append to this string the bsl::string_view
object, obtained from the specified suffix
, and return a reference providing modifiable access to this string. Throw length_error
if the length of the resulting string exceeds max_size()
.
BSLS_PLATFORM_AGGRESSIVE_INLINE BSLSTL_STRING_DEFINE_ONLY_CONVERTIBLE_TO_STRINGVIEW_RETURN_TYPE bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::append | ( | const STRING_VIEW_LIKE_TYPE & | suffix | ) |
BSLSTL_STRING_DEFINE_ONLY_CONVERTIBLE_TO_STRINGVIEW_RETURN_TYPE bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::append | ( | const STRING_VIEW_LIKE_TYPE & | suffix, |
size_type | position, | ||
size_type | numChars = npos |
||
) |
Append to this string the optionally specified numChars
characters starting at the specified position
in the bsl::string_view
object, obtained from the specified suffix
, or its tail starting at position
if numChars
exceeds the length of this tail. If numChars
is not specified, npos
is used. Return a reference providing modifiable access to this string. Throw out_of_range
if position > strView.length()
. Throw length_error
if the length of the resulting string exceeds max_size()
.
basic_string & bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::append | ( | INPUT_ITER | first, |
INPUT_ITER | last | ||
) |
Append to this string the characters in the range starting at the specified first
iterator and ending right before the specified last
iterator of the (template parameter) type INPUT_ITER
. Return a reference providing modifiable access to this string. The behavior is undefined unless first
and last
refer to a sequence of valid values where first
is at a position at or before last
.
BSLS_PLATFORM_AGGRESSIVE_INLINE basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::append | ( | INPUT_ITER | first, |
INPUT_ITER | last | ||
) |
BSLS_PLATFORM_AGGRESSIVE_INLINE basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::append | ( | size_type | numChars, |
CHAR_TYPE | character | ||
) |
Append the specified numChars
copies of the specified character
to this string, and return a reference providing modifiable access to this string.
|
inline |
Assign to this string the value of the specified replacement
string, propagate to this object the allocator of replacement
if the ALLOCATOR
type has trait propagate_on_container_move_assignment
, and return a reference providing modifiable access to this string. The content of replacement
is moved (in constant time) to this string if get_allocator() == rhs.get_allocator()
(after accounting for the aforementioned trait). replacement
is left in a valid but unspecified state. Note that this method has exactly the same behavior as the corresponding operator=
.
BSLS_PLATFORM_AGGRESSIVE_INLINE basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::assign | ( | const basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & | replacement | ) |
Assign to this string the value of the specified replacement
string, propagate to this object the allocator of replacement
if the ALLOCATOR
type has trait propagate_on_container_copy_assignment
, and return a reference providing modifiable access to this string. Note that this method has exactly the same behavior as the corresponding operator=
.
basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::assign | ( | const basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & | replacement, |
size_type | position, | ||
size_type | numChars = npos |
||
) |
Assign to this string the value of the optionally specified numChars
characters starting at the specified position
in the specified replacement
string, or the suffix of replacement
starting at position
if position + numChars > replacement.length()
. If numChars
is not specified, npos
is used. Return a reference providing modifiable access to this string. Throw out_of_range
if position > replacement.length()
.
BSLS_PLATFORM_AGGRESSIVE_INLINE basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::assign | ( | const CHAR_TYPE * | characterString | ) |
Assign to this string the value of the specified null-terminated characterString
(of length CHAR_TRAITS::length(characterString)
), and return a reference providing modifiable access to this string.
BSLS_PLATFORM_AGGRESSIVE_INLINE basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::assign | ( | const CHAR_TYPE * | characterString, |
size_type | numChars | ||
) |
Assign to this string the specified initial numChars
characters in the specified characterString
, and return a reference providing modifiable access to this string. The behavior is undefined unless characterString
is at least numChars
long.
basic_string & bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::assign | ( | const std::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOC2 > & | string | ) |
Assign to this string the value of the specified string
, and return a reference providing modifiable access to this string.
BSLS_PLATFORM_AGGRESSIVE_INLINE basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::assign | ( | const std::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOC2 > & | string | ) |
BSLSTL_STRING_DEFINE_ONLY_CONVERTIBLE_TO_STRINGVIEW_RETURN_TYPE bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::assign | ( | const STRING_VIEW_LIKE_TYPE & | replacement | ) |
Assign to this string the value of the specified replacement
, and return a reference providing modifiable access to this string. Note that this method has exactly the same behavior as the corresponding operator=
.
BSLS_PLATFORM_AGGRESSIVE_INLINE BSLSTL_STRING_DEFINE_ONLY_CONVERTIBLE_TO_STRINGVIEW_RETURN_TYPE bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::assign | ( | const STRING_VIEW_LIKE_TYPE & | replacement | ) |
BSLS_PLATFORM_AGGRESSIVE_INLINE BSLSTL_STRING_DEFINE_ONLY_CONVERTIBLE_TO_STRINGVIEW_RETURN_TYPE bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::assign | ( | const STRING_VIEW_LIKE_TYPE & | replacement, |
size_type | position, | ||
size_type | numChars | ||
) |
BSLSTL_STRING_DEFINE_ONLY_CONVERTIBLE_TO_STRINGVIEW_RETURN_TYPE bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::assign | ( | const STRING_VIEW_LIKE_TYPE & | replacement, |
size_type | position, | ||
size_type | numChars = npos |
||
) |
Assign to this string the value of the optionally specified numChars
characters starting at the specified position
in the specified replacement
, or the suffix of the replacement
starting at position
if position + numChars > replacement.length()
. If numChars
is not specified, npos
is used. Return a reference providing modifiable access to this string. Throw out_of_range
if position > replacement.length()
.
basic_string & bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::assign | ( | INPUT_ITER | first, |
INPUT_ITER | last | ||
) |
Assign to this string the characters in the range starting at the specified first
iterator and ending right before the specified last
iterator of the (template parameter) type INPUT_ITER
. Return a reference providing modifiable access to this string. The behavior is undefined unless first
and last
refer to a sequence of valid values where first
is at a position at or before last
.
BSLS_PLATFORM_AGGRESSIVE_INLINE basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::assign | ( | INPUT_ITER | first, |
INPUT_ITER | last | ||
) |
BSLS_PLATFORM_AGGRESSIVE_INLINE basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::assign | ( | size_type | numChars, |
CHAR_TYPE | character | ||
) |
Assign to this string the value of a string of the specified numChars
length whose every character is equal to the specified character
, and return a reference providing modifiable access to this string.
basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::reference bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::at | ( | size_type | position | ) |
Return a reference providing modifiable access to the character at the specified position
in this string. Throw out_of_range
if position >= length()
.
BSLS_PLATFORM_AGGRESSIVE_INLINE basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::const_reference bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::at | ( | size_type | position | ) | const |
Return a reference providing non-modifiable access to the character at the specified position
in this string. Throw out_of_range
if position >= length()
.
|
inline |
Return a reference providing modifiable access to the character at the last position in this string. The behavior is undefined if this string is empty. Note that the last position is length() - 1
.
|
inline |
Return a reference providing non-modifiable access to the character at the last position in this string. The behavior is undefined if this string is empty. Note that the last position is length() - 1
.
iterator bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::begin | ( | ) |
Return an iterator referring to the first character in this modifiable string (or the past-the-end iterator if this string is empty).
bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::BSLMF_NESTED_TRAIT_DECLARATION_IF | ( | basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > | , |
BloombergLP::bslmf::IsBitwiseMoveable | , | ||
BloombergLP::bslmf::IsBitwiseMoveable< ALLOCATOR >::value | |||
) |
CHAR_TYPE
is required to be a POD as per the Standard, which makes CHAR_TYPE
bitwise-movable, so basic_string is bitwise-movable as long as the (template parameter) type ALLOCATOR
is also bitwise-movable.
|
inline |
Return an address providing non-modifiable access to the null-terminated buffer of length() + 1
characters whose contents are identical to the value of this string. Note that any call to the string destructor or any of its manipulators invalidates the returned pointer.
|
inline |
Return the capacity of this string, i.e., the maximum length for which resizing is guaranteed not to trigger a reallocation.
|
inline |
Return an iterator providing non-modifiable access to the first character of this string (or the past-the-end iterator if this string is empty).
|
inline |
BSLS_PLATFORM_AGGRESSIVE_INLINE void bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::clear | ( | ) |
Reset this string to an empty value. Note that the capacity may change (or not if BASIC_STRING_DEALLOCATE_IN_CLEAR
is false
). Note that the Standard doesn't allow to reduce capacity on clear
.
BSLS_PLATFORM_AGGRESSIVE_INLINE int bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::compare | ( | const basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & | other | ) | const |
Lexicographically compare this string with the specified other
string, and return a negative value if this string is less than other
, a positive value if it is greater than other
, and 0 in case of equality. CHAR_TRAITS::lt
is used to compare characters. See {Lexicographical Comparisons}.
BSLS_PLATFORM_AGGRESSIVE_INLINE int bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::compare | ( | const CHAR_TYPE * | other | ) | const |
Lexicographically compare this string with the specified null-terminated other
string (of length CHAR_TRAITS::length(other)
), and return a negative value if this string is less than other
, a positive value if it is greater than other
, and 0 in case of equality. CHAR_TRAITS::lt
is used to compare characters. See {Lexicographical Comparisons}.
int bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::compare | ( | const STRING_VIEW_LIKE_TYPE &other | BSLSTL_STRING_DECLARE_ONLY_CONVERTIBLE_TO_STRINGVIEW_PARAM_VOID | ) | const |
Lexicographically compare this string with the specified other
, and return a negative value if this string is less than other
, a positive value if it is greater than other
, and 0 in case of equality. CHAR_TRAITS::lt
is used to compare characters. See {Lexicographical Comparisons}. The behavior is undefined unless the conversion from STRING_VIEW_LIKE_TYPE
to bsl::basic_string_view<CHAR_TYPE, CHAR_TRAITS>
does not throw any exception. Note that this behavior differs from the behavior implemented in the standard container, where the following noexcept specification is used:
BSLS_PLATFORM_AGGRESSIVE_INLINE int bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::compare | ( | const STRING_VIEW_LIKE_TYPE &other | BSLSTL_STRING_DEFINE_ONLY_CONVERTIBLE_TO_STRINGVIEW_PARAM_VOID | ) | const |
int bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::compare | ( | size_type | lhsPosition, |
size_type | lhsNumChars, | ||
const basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & | other, | ||
size_type | otherPosition, | ||
size_type | otherNumChars = npos |
||
) | const |
Lexicographically compare the substring of this string of the specified lhsNumChars
length starting at the specified lhsPosition
(or the suffix of this string starting at lhsPosition
if lhsPosition + lhsNumChars > length()
) with the substring of the specified other
string of the optionally specified otherNumChars
length starting at the specified otherPosition
(or the suffix of other
starting at otherPosition
if otherPosition + otherNumChars > other.length()
). If numChars
is not specified, npos
is used. Return a negative value if the indicated substring of this string is less than the indicated substring of other
, a positive value if it is greater than the indicated substring of other
, and 0 in case of equality. CHAR_TRAITS::lt
is used to compare characters. Throw out_of_range
if lhsPosition > length()
or otherPosition > other.length()
. See {Lexicographical Comparisons}.
BSLS_PLATFORM_AGGRESSIVE_INLINE int bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::compare | ( | size_type | lhsPosition, |
size_type | lhsNumChars, | ||
const CHAR_TYPE * | other | ||
) | const |
Lexicographically compare the substring of this string of the specified lhsNumChars
length starting at the specified lhsPosition
(or the suffix of this string starting at lhsPosition
if lhsPosition + lhsNumChars > length()
) with the specified null-terminated other
string (of length CHAR_TRAITS::length(other)
), and return a negative value if the indicated substring of this string is less than other
, a positive value if it is greater than other
, and 0 in case of equality. CHAR_TRAITS::lt
is used to compare characters. Throw out_of_range
if lhsPosition > length()
. See {Lexicographical Comparisons}.
int bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::compare | ( | size_type | lhsPosition, |
size_type | lhsNumChars, | ||
const CHAR_TYPE * | other, | ||
size_type | otherNumChars | ||
) | const |
Lexicographically compare the substring of this string of the specified lhsNumChars
length starting at the specified lhsPosition
(or the suffix of this string starting at lhsPosition
if lhsPosition + lhsNumChars > length()
) with the specified other
string of the specified otherNumChars
length, and return a negative value if the indicated substring of this string is less than other
, a positive value if it is greater than other
, and 0 in case of equality. CHAR_TRAITS::lt
is used to compare characters. Throw out_of_range
if lhsPosition > length()
. See {Lexicographical Comparisons}.
int bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::compare | ( | size_type | lhsPosition, |
size_type | lhsNumChars, | ||
const STRING_VIEW_LIKE_TYPE & | other, | ||
size_type | otherPosition, | ||
size_type otherNumChars | BSLSTL_STRING_DEFINE_ONLY_CONVERTIBLE_TO_STRINGVIEW_PARAM_VOID = npos BSLSTL_STRING_DECLARE_ONLY_CONVERTIBLE_TO_STRINGVIEW_PARAM_VOID |
||
) | const |
Lexicographically compare the substring of this string of the specified lhsNumChars
length starting at the specified lhsPosition
(or the suffix of this string starting at lhsPosition
if lhsPosition + lhsNumChars > length()
) with the substring of the specified other
of the optionally specified otherNumChars
length starting at the specified otherPosition
(or the suffix of other
starting at otherPosition
if otherPosition + otherNumChars > other.length()
). If numChars
is not specified, npos
is used. Return a negative value if the indicated substring of this string is less than the indicated substring of other
, a positive value if it is greater than the indicated substring of other
, and 0 in case of equality. CHAR_TRAITS::lt
is used to compare characters. See {Lexicographical Comparisons}. Throw out_of_range
if lhsPosition > length()
or otherPosition > other.length()
.
int bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::compare | ( | size_type | position, |
size_type | numChars, | ||
const basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & | other | ||
) | const |
Lexicographically compare the substring of this string of the specified numChars
length starting at the specified position
(or the suffix of this string starting at position
if position + numChars > length()
) with the specified other
string, and return a negative value if the indicated substring of this string is less than other
, a positive value if it is greater than other
, and 0 in case of equality. CHAR_TRAITS::lt
is used to compare characters. See {Lexicographical Comparisons}. Throw out_of_range
if position > length()
.
int bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::compare | ( | size_type | position, |
size_type | numChars, | ||
const STRING_VIEW_LIKE_TYPE &other | BSLSTL_STRING_DECLARE_ONLY_CONVERTIBLE_TO_STRINGVIEW_PARAM_VOID | ||
) | const |
Lexicographically compare the substring of this string of the specified numChars
length starting at the specified position
(or the suffix of this string starting at position
if position + numChars > length()
) with the specified other
, and return a negative value if the indicated substring of this string is less than other
, a positive value if it is greater than other
, and 0 in case of equality. CHAR_TRAITS::lt
is used to compare characters. See {Lexicographical Comparisons}. Throw out_of_range
if position > length()
.
basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::size_type bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::copy | ( | CHAR_TYPE * | characterString, |
size_type | numChars, | ||
size_type | position = 0 |
||
) | const |
Copy from this string, starting from the optionally specified position
, the specified numChars
or length() - position
characters, whichever is smaller, into the specified characterString
buffer, and return the number of characters copied. If position
is not specified, 0 is used. Throw out_of_range
if position > length()
. The behavior is undefined unless characterString
is at least numChars
long. Note that the output characterString
is not null-terminated.
|
inline |
Return a reverse iterator providing non-modifiable access to the last character of this string (or the past-the-end reverse iterator if this string is empty).
BSLS_PLATFORM_AGGRESSIVE_INLINE basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::const_reverse_iterator bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::crend | ( | ) | const |
|
inline |
Return an address providing modifiable access to the null-terminated buffer of length() + 1
characters whose contents are identical to the value of this string. Note that any call to the string destructor or any of its manipulators invalidates the returned pointer.
|
inline |
Return an address providing non-modifiable access to the null-terminated buffer of length() + 1
characters whose contents are identical to the value of this string. Note that any call to the string destructor or any of its manipulators invalidates the returned pointer.
|
inline |
|
inline |
|
inline |
BSLS_PLATFORM_AGGRESSIVE_INLINE bool bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::ends_with | ( | basic_string_view< CHAR_TYPE, CHAR_TRAITS > | characterString | ) | const |
Return true
if the length of this string is equal to or greater than the length of the specified characterString
and the last characterString.length()
characters of this string are equal to the characters of the characterString
, and false
otherwise. CHAR_TRAITS::compare
is used to compare characters. See {Lexicographical Comparisons}.
BSLS_PLATFORM_AGGRESSIVE_INLINE bool bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::ends_with | ( | CHAR_TYPE | character | ) | const |
Return true
if this string contains at least one symbol and the last symbol of this string is equal to the specified character
, and false
otherwise. CHAR_TRAITS::eq
is used to compare characters. See {Lexicographical Comparisons}.
BSLS_PLATFORM_AGGRESSIVE_INLINE bool bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::ends_with | ( | const CHAR_TYPE * | characterString | ) | const |
Return true
if the length of this string is equal to or greater than the length of the specified characterString
and the last CHAR_TRAITS::length(characterString)
characters of this string are equal to the characters of the characterString
, and false
otherwise. CHAR_TRAITS::compare
is used to compare characters. See {Lexicographical Comparisons}.
basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::iterator bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::erase | ( | const_iterator | first, |
const_iterator | last | ||
) |
Erase from this string a substring defined by the specified pair of first
and last
iterators within this string. Return an iterator providing modifiable access to the character at the last
position prior to erasing. If no such character exists, return end()
. This method invalidates existing iterators pointing to first
or a subsequent position. The behavior is undefined unless first
and last
are both within the range [cbegin() .. cend()]
and first <= last
.
basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::iterator bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::erase | ( | const_iterator | position | ) |
basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::erase | ( | size_type | position = 0 , |
size_type | numChars = npos |
||
) |
Erase from this string the substring of length the optionally specified numChars
or original.length() - position
, whichever is smaller, starting at the optionally specified position
. If position
is not specified, the first position is used (i.e., position
is set to 0). Return a reference providing modifiable access to this string. If numChars
equals npos
, then the remaining length of the string is erased (i.e., numChars
is set to length() - position
). Throw out_of_range
if position > length()
.
basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::size_type bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::find | ( | CHAR_TYPE | character, |
size_type | position = 0 |
||
) | const |
Return the position of the first occurrence of the specified character
, if such an occurrence can be found in this string (on or after the optionally specified position
if such a position
is specified), and return npos
otherwise.
BSLS_PLATFORM_AGGRESSIVE_INLINE basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::size_type bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::find | ( | const basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & | substring, |
size_type | position = 0 |
||
) | const |
Return the starting position of the first occurrence of the specified substring
, if such a substring can be found in this string (on or after the optionally specified position
if such a position
is specified) using CHAR_TRAITS::eq
to compare characters, and return npos
otherwise.
basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::size_type bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::find | ( | const CHAR_TYPE * | substring, |
size_type | position, | ||
size_type | numChars | ||
) | const |
Return the starting position of the first occurrence of the specified substring
of the optionally specified numChars
length, if such a substring can be found in this string (on or after the optionally specified position
if such a position
is specified) using CHAR_TRAITS::eq
to compare characters, and return npos
otherwise. If numChars
is not specified, CHAR_TRAITS::length(substring)
is used.
BSLS_PLATFORM_AGGRESSIVE_INLINE basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::size_type bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::find | ( | const CHAR_TYPE * | substring, |
size_type | position = 0 |
||
) | const |
BSLS_PLATFORM_AGGRESSIVE_INLINE basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::size_type bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::find | ( | const STRING_VIEW_LIKE_TYPE & | substring, |
size_type position | BSLSTL_STRING_DEFINE_ONLY_CONVERTIBLE_TO_STRINGVIEW_PARAM_VOID | ||
) | const |
size_type bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::find | ( | const STRING_VIEW_LIKE_TYPE & | substring, |
size_type | position = 0 BSLSTL_STRING_DECLARE_ONLY_CONVERTIBLE_TO_STRINGVIEW_PARAM_VOID |
||
) | const |
Return the starting position of the first occurrence of the specified substring
, if such a substring can be found in this string (on or after the optionally specified position
if such a position
is specified) using CHAR_TRAITS::eq
to compare characters, and return npos
otherwise. The behavior is undefined unless the conversion from STRING_VIEW_LIKE_TYPE
to bsl::basic_string_view<CHAR_TYPE, CHAR_TRAITS>
does not throw any exception. Note that this behavior differs from the behavior implemented in the standard container, where the following noexcept specification is used:
BSLS_PLATFORM_AGGRESSIVE_INLINE basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::size_type bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::find_first_not_of | ( | CHAR_TYPE | character, |
size_type | position = 0 |
||
) | const |
Return the position of the first occurrence of a character different from the specified character
, if such an occurrence can be found in this string (on or after the optionally specified position
if such a position
is specified), and return npos
otherwise.
BSLS_PLATFORM_AGGRESSIVE_INLINE basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::size_type bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::find_first_not_of | ( | const basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & | characterString, |
size_type | position = 0 |
||
) | const |
Return the position of the first occurrence of a character not belonging to the specified characterString
, if such an occurrence can be found in this string (on or after the optionally specified position
if such a position
is specified), and return npos
otherwise.
basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::size_type bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::find_first_not_of | ( | const CHAR_TYPE * | characterString, |
size_type | position, | ||
size_type | numChars | ||
) | const |
Return the position of the first occurrence of a character not belonging to the specified characterString
of the optionally specified numChars
length, if such an occurrence can be found in this string (on or after the optionally specified position
if such a position
is specified), and return npos
otherwise. If numChars
is not specified, CHAR_TRAITS::length(characterString)
is used.
BSLS_PLATFORM_AGGRESSIVE_INLINE basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::size_type bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::find_first_not_of | ( | const CHAR_TYPE * | characterString, |
size_type | position = 0 |
||
) | const |
BSLS_PLATFORM_AGGRESSIVE_INLINE basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::size_type bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::find_first_not_of | ( | const STRING_VIEW_LIKE_TYPE & | characterString, |
size_type position | BSLSTL_STRING_DEFINE_ONLY_CONVERTIBLE_TO_STRINGVIEW_PARAM_VOID | ||
) | const |
size_type bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::find_first_not_of | ( | const STRING_VIEW_LIKE_TYPE & | characterString, |
size_type | position = 0 BSLSTL_STRING_DECLARE_ONLY_CONVERTIBLE_TO_STRINGVIEW_PARAM_VOID |
||
) | const |
Return the position of the first occurrence of a character not belonging to the specified characterString
, if such an occurrence can be found in this string (on or after the optionally specified position
if such a position
is specified), and return npos
otherwise. The behavior is undefined unless the conversion from STRING_VIEW_LIKE_TYPE
to bsl::basic_string_view<CHAR_TYPE, CHAR_TRAITS>
does not throw any exception. Note that this behavior differs from the behavior implemented in the standard container, where the following noexcept specification is used:
BSLS_PLATFORM_AGGRESSIVE_INLINE basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::size_type bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::find_first_of | ( | CHAR_TYPE | character, |
size_type | position = 0 |
||
) | const |
Return the position of the first occurrence of the specified character
, if such an occurrence can be found in this string (on or after the optionally specified position
if such a position
is specified), and return npos
otherwise.
BSLS_PLATFORM_AGGRESSIVE_INLINE basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::size_type bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::find_first_of | ( | const basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & | characterString, |
size_type | position = 0 |
||
) | const |
Return the position of the first occurrence of a character belonging to the specified characterString
, if such an occurrence can be found in this string (on or after the optionally specified position
if such a position
is specified), and return npos
otherwise.
basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::size_type bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::find_first_of | ( | const CHAR_TYPE * | characterString, |
size_type | position, | ||
size_type | numChars | ||
) | const |
Return the position of the first occurrence of a character belonging to the specified characterString
of the optionally specified numChars
length, if such an occurrence can be found in this string (on or after the optionally specified position
if such a position
is specified), and return npos
otherwise. If numChars
is not specified, CHAR_TRAITS::length(characterString)
is used.
BSLS_PLATFORM_AGGRESSIVE_INLINE basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::size_type bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::find_first_of | ( | const CHAR_TYPE * | characterString, |
size_type | position = 0 |
||
) | const |
BSLS_PLATFORM_AGGRESSIVE_INLINE basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::size_type bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::find_first_of | ( | const STRING_VIEW_LIKE_TYPE & | characterString, |
size_type position | BSLSTL_STRING_DEFINE_ONLY_CONVERTIBLE_TO_STRINGVIEW_PARAM_VOID | ||
) | const |
size_type bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::find_first_of | ( | const STRING_VIEW_LIKE_TYPE & | characterString, |
size_type | position = 0 BSLSTL_STRING_DECLARE_ONLY_CONVERTIBLE_TO_STRINGVIEW_PARAM_VOID |
||
) | const |
Return the position of the first occurrence of a character belonging to the specified characterString
, if such an occurrence can be found in this string (on or after the optionally specified position
if such a position
is specified), and return npos
otherwise. The behavior is undefined unless the conversion from STRING_VIEW_LIKE_TYPE
to bsl::basic_string_view<CHAR_TYPE, CHAR_TRAITS>
does not throw any exception. Note that this behavior differs from the behavior implemented in the standard container, where the following noexcept specification is used:
BSLS_PLATFORM_AGGRESSIVE_INLINE basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::size_type bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::find_last_not_of | ( | CHAR_TYPE | character, |
size_type | position = npos |
||
) | const |
Return the position of the last occurrence of a character different from the specified character
, if such an occurrence can be found in this string (on or before the optionally specified position
if such a position
is specified), and return npos
otherwise.
BSLS_PLATFORM_AGGRESSIVE_INLINE basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::size_type bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::find_last_not_of | ( | const basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & | characterString, |
size_type | position = npos |
||
) | const |
Return the position of the last occurrence of a character not belonging to the specified characterString
, if such an occurrence can be found in this string (on or before the optionally specified position
if such a position
is specified), and return npos
otherwise.
basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::size_type bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::find_last_not_of | ( | const CHAR_TYPE * | characterString, |
size_type | position, | ||
size_type | numChars | ||
) | const |
Return the position of the last occurrence of a character not belonging to the specified characterString
of the optionally specified numChars
length, if such an occurrence can be found in this string (on or before the optionally specified position
if such a position
is specified), and return npos
otherwise. If numChars
is not specified, CHAR_TRAITS::length(characterString)
is used.
BSLS_PLATFORM_AGGRESSIVE_INLINE basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::size_type bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::find_last_not_of | ( | const CHAR_TYPE * | characterString, |
size_type | position = npos |
||
) | const |
BSLS_PLATFORM_AGGRESSIVE_INLINE basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::size_type bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::find_last_not_of | ( | const STRING_VIEW_LIKE_TYPE & | characterString, |
size_type position | BSLSTL_STRING_DEFINE_ONLY_CONVERTIBLE_TO_STRINGVIEW_PARAM_VOID | ||
) | const |
size_type bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::find_last_not_of | ( | const STRING_VIEW_LIKE_TYPE & | characterString, |
size_type | position = npos BSLSTL_STRING_DECLARE_ONLY_CONVERTIBLE_TO_STRINGVIEW_PARAM_VOID |
||
) | const |
Return the position of the last occurrence of a character not belonging to the specified characterString
, if such an occurrence can be found in this string (on or before the optionally specified position
if such a position
is specified), and return npos
otherwise. The behavior is undefined unless the conversion from STRING_VIEW_LIKE_TYPE
to bsl::basic_string_view<CHAR_TYPE, CHAR_TRAITS>
does not throw any exception. Note that this behavior differs from the behavior implemented in the standard container, where the following noexcept specification is used:
BSLS_PLATFORM_AGGRESSIVE_INLINE basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::size_type bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::find_last_of | ( | CHAR_TYPE | character, |
size_type | position = npos |
||
) | const |
Return the position of the last occurrence of the specified character
, if such an occurrence can be found in this string (on or before the optionally specified position
if such a position
is specified), and return npos
otherwise.
BSLS_PLATFORM_AGGRESSIVE_INLINE basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::size_type bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::find_last_of | ( | const basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & | characterString, |
size_type | position = npos |
||
) | const |
Return the position of the last occurrence of a character belonging to the specified characterString
, if such an occurrence can be found in this string (on or before the optionally specified position
if such a position
is specified), and return npos
otherwise.
basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::size_type bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::find_last_of | ( | const CHAR_TYPE * | characterString, |
size_type | position, | ||
size_type | numChars | ||
) | const |
Return the position of the last occurrence of a character belonging to the specified characterString
of the optionally specified numChars
length, if such an occurrence can be found in this string (on or before the optionally specified position
if such a position
is specified), and return npos
otherwise. If numChars
is not specified, CHAR_TRAITS::length(characterString)
is used.
BSLS_PLATFORM_AGGRESSIVE_INLINE basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::size_type bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::find_last_of | ( | const CHAR_TYPE * | characterString, |
size_type | position = npos |
||
) | const |
BSLS_PLATFORM_AGGRESSIVE_INLINE basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::size_type bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::find_last_of | ( | const STRING_VIEW_LIKE_TYPE & | characterString, |
size_type position | BSLSTL_STRING_DEFINE_ONLY_CONVERTIBLE_TO_STRINGVIEW_PARAM_VOID | ||
) | const |
size_type bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::find_last_of | ( | const STRING_VIEW_LIKE_TYPE & | characterString, |
size_type | position = npos BSLSTL_STRING_DECLARE_ONLY_CONVERTIBLE_TO_STRINGVIEW_PARAM_VOID |
||
) | const |
Return the position of the last occurrence of a character belonging to the specified characterString
, if such an occurrence can be found in this string (on or before the optionally specified position
if such a position
is specified), and return npos
otherwise. The behavior is undefined unless the conversion from STRING_VIEW_LIKE_TYPE
to bsl::basic_string_view<CHAR_TYPE, CHAR_TRAITS>
does not throw any exception. Note that this behavior differs from the behavior implemented in the standard container, where the following noexcept specification is used:
|
inline |
Return a reference providing modifiable access to the character at the first position in this string. The behavior is undefined if this string is empty.
|
inline |
Return a reference providing non-modifiable access to the character at the first position in this string. The behavior is undefined if this string is empty.
|
inline |
basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::iterator bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::insert | ( | const_iterator | position, |
CHAR_TYPE | character | ||
) |
Insert the specified character
at the specified position
in this string, and return an iterator providing modifiable access to the inserted character. The behavior is undefined unless position
is a valid iterator on this string.
iterator bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::insert | ( | const_iterator | position, |
INPUT_ITER | first, | ||
INPUT_ITER | last | ||
) |
Insert at the specified position
in this string the characters in the range starting at the specified first
iterator and ending right before the specified last
iterator of the (template parameter) type INPUT_ITER
, and return an iterator providing modifiable access to the first inserted character, or a non-const
copy of position
if first == last
. The behavior is undefined unless position
is a valid iterator on this string, and first
and last
refer to a sequence of valid values where first
is at a position at or before last
.
|
inline |
|
inline |
Insert at the specified position
in this string the specified numChars
copies of the specified character
, and return an iterator providing modifiable access to the first inserted character, or a non-const
copy of position
if 0 == numChars
. The behavior is undefined unless position
is a valid iterator on this string.
BSLS_PLATFORM_AGGRESSIVE_INLINE basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::insert | ( | size_type | position, |
const basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & | other | ||
) |
Insert at the specified position
in this string a copy of the specified other
string, and return a reference providing modifiable access to this string. Throw out_of_range
if position > length()
.
basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::insert | ( | size_type | position, |
const basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & | other, | ||
size_type | sourcePosition, | ||
size_type | numChars = npos |
||
) |
Insert at the specified position
in this string the optionally specified numChars
characters starting at the specified sourcePosition
in the specified other
string, or the suffix of other
starting at sourcePosition
if sourcePosition + numChars > other.length()
. If numChars
is not specified, npos
is used. Return a reference providing modifiable access to this string. Throw out_of_range
if position > length()
or sourcePosition > other.length()
.
BSLS_PLATFORM_AGGRESSIVE_INLINE basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::insert | ( | size_type | position, |
const CHAR_TYPE * | characterString | ||
) |
Insert at the specified position
in this string the specified null-terminated characterString
(of length CHAR_TRAITS::length(characterString)
), and return a reference providing modifiable access to this string. Throw out_of_range
if position > length()
.
basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::insert | ( | size_type | position, |
const CHAR_TYPE * | characterString, | ||
size_type | numChars | ||
) |
Insert at the specified position
in this string the specified initial numChars
characters in the specified characterString
, and return a reference providing modifiable access to this string. Throw out_of_range
if position > length()
. The behavior is undefined unless characterString
is at least numChars
long.
BSLSTL_STRING_DEFINE_ONLY_CONVERTIBLE_TO_STRINGVIEW_RETURN_TYPE bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::insert | ( | size_type | position, |
const STRING_VIEW_LIKE_TYPE & | other | ||
) |
Insert at the specified position
in this string the bsl::string_view
object, obtained from the specified other
, and return a reference providing modifiable access to this string. Throw out_of_range
if position > length()
. Throw length_error
if the length of the resulting string exceeds max_size()
.
BSLSTL_STRING_DEFINE_ONLY_CONVERTIBLE_TO_STRINGVIEW_RETURN_TYPE bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::insert | ( | size_type | position, |
const STRING_VIEW_LIKE_TYPE & | other, | ||
size_type | sourcePosition, | ||
size_type | numChars = npos |
||
) |
Insert at the specified position
in this string the optionally specified numChars
characters starting at the specified sourcePosition
in the bsl::string_view
object, obtained from the specified other
, or the suffix of this object starting at sourcePosition
if sourcePosition + numChars > other.length()
. If numChars
is not specified, npos
is used. Return a reference providing modifiable access to this string. Throw out_of_range
if position > length()
or sourcePosition > other.length()
. Throw length_error
if the length of the resulting string exceeds max_size()
.
basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::insert | ( | size_type | position, |
size_type | numChars, | ||
CHAR_TYPE | character | ||
) |
Insert at the specified position
in this string the specified numChars
copies of the specified character
, and return a reference providing modifiable access to this string. Throw out_of_range
if position > length()
.
|
inline |
Return the length of this string. Note that this number may differ from CHAR_TRAITS::length(c_str())
in case the string contains null characters. Also note that a null-terminating character added by the c_str
method is not counted in this length.
|
inline |
Return the maximal possible length of this string. Note that requests to create a string longer than this number of characters are guaranteed to raise a length_error
exception.
BSLS_PLATFORM_AGGRESSIVE_INLINE bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::operator basic_string_view< CHAR_TYPE, CHAR_TRAITS > | ( | ) | const |
Convert this object to a string_view type instantiated with the same character type and traits type. The return view will contain the same sequence of characters as this object. Note that this conversion operator can be invoked implicitly (e.g., during argument passing).
|
inline |
Convert this object to a string type native to the compiler's library, instantiated with the same character type and traits type, but not necessarily the same allocator type. The return string will contain the same sequence of characters as orig
and will have a default-constructed allocator. Note that this conversion operator can be invoked implicitly (e.g., during argument passing).
BSLS_PLATFORM_AGGRESSIVE_INLINE basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::operator+= | ( | CHAR_TYPE | character | ) |
Append the specified character
to this string, and return a reference providing modifiable access to this string.
BSLS_PLATFORM_AGGRESSIVE_INLINE basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::operator+= | ( | const basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & | rhs | ) |
Append the specified rhs
string to this string, and return a reference providing modifiable access to this string.
BSLS_PLATFORM_AGGRESSIVE_INLINE basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::operator+= | ( | const CHAR_TYPE * | rhs | ) |
Append the specified null-terminated rhs
string (of length CHAR_TRAITS::length(rhs)
) to this string, and return a reference providing modifiable access to this string.
basic_string & bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::operator+= | ( | const std::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOC2 > & | rhs | ) |
Append the specified rhs
string to this string, and return a reference providing modifiable access to this string.
BSLS_PLATFORM_AGGRESSIVE_INLINE basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::operator+= | ( | const std::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOC2 > & | rhs | ) |
BSLSTL_STRING_DEFINE_ONLY_CONVERTIBLE_TO_STRINGVIEW_RETURN_TYPE bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::operator+= | ( | const STRING_VIEW_LIKE_TYPE & | rhs | ) |
Append the specified rhs
to this string, and return a reference providing modifiable access to this string.
BSLS_PLATFORM_AGGRESSIVE_INLINE BSLSTL_STRING_DEFINE_ONLY_CONVERTIBLE_TO_STRINGVIEW_RETURN_TYPE bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::operator+= | ( | const STRING_VIEW_LIKE_TYPE & | rhs | ) |
BSLS_PLATFORM_AGGRESSIVE_INLINE basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::operator= | ( | CHAR_TYPE | character | ) |
Assign to this string the value of the string of length one consisting of the specified character
, and return a reference providing modifiable access to this string.
BSLS_PLATFORM_AGGRESSIVE_INLINE basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::operator= | ( | const basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & | rhs | ) |
Assign to this string the value of the specified rhs
string, propagate to this object the allocator of rhs
if the ALLOCATOR
type has trait propagate_on_container_copy_assignment
, and return a reference providing modifiable access to this string.
BSLS_PLATFORM_AGGRESSIVE_INLINE basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::operator= | ( | const CHAR_TYPE * | rhs | ) |
Assign to this string the value of the specified null-terminated rhs
string (of length CHAR_TRAITS::length(characterString)
), and return a reference providing modifiable access to this string.
basic_string & bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::operator= | ( | const std::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOC2 > & | rhs | ) |
Assign to this string the value of the specified rhs
string, and return a reference providing modifiable access to this string.
BSLS_PLATFORM_AGGRESSIVE_INLINE basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::operator= | ( | const std::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOC2 > & | rhs | ) |
|
inline |
Assign to this string the value of the specified rhs
object, and return a reference providing modifiable access to this string.
|
inline |
Return a reference providing modifiable access to the character at the specified position
in this string if position < length()
, or a reference providing non-modifiable access to the null-terminating character if position == length()
. The behavior is undefined unless position <= length()
, and, in the case of position == length()
, the null-terminating character is not modified through the returned reference.
|
inline |
|
inline |
Erase the last character from this string. The behavior is undefined if this string is empty.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::privateReplace | ( | size_type | outPosition, |
size_type | outNumChars, | ||
INPUT_ITER | first, | ||
INPUT_ITER | last, | ||
std::forward_iterator_tag | |||
) |
basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::privateReplace | ( | size_type | outPosition, |
size_type | outNumChars, | ||
INPUT_ITER | first, | ||
INPUT_ITER | last, | ||
std::input_iterator_tag | |||
) |
|
inline |
|
inline |
void bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::push_back | ( | CHAR_TYPE | character | ) |
|
inline |
Return a reverse iterator referring to the last character in this modifiable string (or the past-the-end reverse iterator if this string is empty).
|
inline |
|
inline |
BSLS_PLATFORM_AGGRESSIVE_INLINE basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::const_reverse_iterator bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::rend | ( | ) | const |
basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::replace | ( | const_iterator | first, |
const_iterator | last, | ||
const basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & | replacement | ||
) |
Replace the substring in the range starting at the specified first
position and ending right before the specified last
position with the specified replacement
string. Return a reference providing modifiable access to this string. The behavior is undefined unless first
and last
are both within the range [cbegin() .. cend()]
and first <= last
.
BSLS_PLATFORM_AGGRESSIVE_INLINE basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::replace | ( | const_iterator | first, |
const_iterator | last, | ||
const CHAR_TYPE * | characterString | ||
) |
Replace the substring in the range starting at the specified first
position and ending right before the specified last
position with the specified null-terminated characterString
(of length CHAR_TRAITS::length(characterString)
). Return a reference providing modifiable access to this string. The behavior is undefined unless first
and last
are both within the range [cbegin() .. cend()]
and first <= last
.
basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::replace | ( | const_iterator | first, |
const_iterator | last, | ||
const CHAR_TYPE * | characterString, | ||
size_type | numChars | ||
) |
Replace the substring in the range starting at the specified first
position and ending right before the specified last
position with the specified initial numChars
characters in the specified characterString
. Return a reference providing modifiable access to this string. The behavior is undefined unless first
and last
are both within the range [cbegin() .. cend()]
, first <= last
, and characterString
is at least numChars
long.
BSLSTL_STRING_DEFINE_ONLY_CONVERTIBLE_TO_STRINGVIEW_RETURN_TYPE bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::replace | ( | const_iterator | first, |
const_iterator | last, | ||
const STRING_VIEW_LIKE_TYPE & | replacement | ||
) |
Replace the substring in the range starting at the specified first
position and ending right before the specified last
position with the specified replacement
. Return a reference providing modifiable access to this string. The behavior is undefined unless first
and last
are both within the range [cbegin() .. cend()]
and first <= last
.
basic_string & bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::replace | ( | const_iterator | first, |
const_iterator | last, | ||
INPUT_ITER | stringFirst, | ||
INPUT_ITER | stringLast | ||
) |
Replace the substring in the range starting at the specified first
position and ending right before the specified last
position with the characters in the range starting at the specified stringFirst
iterator and ending right before the specified stringLast
iterator of the (template parameter) type INPUT_ITER
. Return a reference providing modifiable access to this string. The behavior is undefined unless first
and last
are both within the range [cbegin() .. cend()]
, first <= last
, and stringFirst
and stringLast
refer to a sequence of valid values where stringFirst
is at a position at or before stringLast
.
|
inline |
basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::replace | ( | const_iterator | first, |
const_iterator | last, | ||
size_type | numChars, | ||
CHAR_TYPE | character | ||
) |
Replace the substring in the range starting at the specified first
position and ending right before the specified last
position with the specified numChars
copies of the specified character
. Return a reference providing modifiable access to this string. The behavior is undefined unless first
and last
are both within the range [cbegin() .. cend()]
and first <= last
.
basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::replace | ( | size_type | outPosition, |
size_type | outNumChars, | ||
const basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & | replacement | ||
) |
Replace the specified outNumChars
characters starting at the specified outPosition
in this string (or the suffix of this string starting at outPosition
if outPosition + outNumChars > length()
) with the specified replacement
string, and return a reference providing modifiable access to this string. Throw out_of_range
if outPosition > length()
.
basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::replace | ( | size_type | outPosition, |
size_type | outNumChars, | ||
const basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & | replacement, | ||
size_type | position, | ||
size_type | numChars = npos |
||
) |
Replace the specified outNumChars
characters starting at the specified outPosition
in this string (or the suffix of this string starting at outPosition
if outPosition + outNumChars > length()
) with the optionally specified numChars
characters starting at the specified position
in the specified replacement
string (or the suffix of replacement
starting at position
if position + numChars > replacement.length()
). If numChars
is not specified, npos
is used. Return a reference providing modifiable access to this string. Throw out_of_range
if outPosition > length()
or position > replacement.length()
.
BSLS_PLATFORM_AGGRESSIVE_INLINE basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::replace | ( | size_type | outPosition, |
size_type | outNumChars, | ||
const CHAR_TYPE * | characterString | ||
) |
Replace the specified outNumChars
characters starting at the specified outPosition
in this string (or the suffix of this string starting at outPosition
if outPosition + outNumChars > length()
) with the specified null-terminated characterString
(of length CHAR_TRAITS::length(characterString)
). Return a reference providing modifiable access to this string. Throw out_of_range
if outPosition > length()
.
basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::replace | ( | size_type | outPosition, |
size_type | outNumChars, | ||
const CHAR_TYPE * | characterString, | ||
size_type | numChars | ||
) |
Replace the specified outNumChars
characters starting at the specified outPosition
in this string (or the suffix of this string starting at outPosition
if outPosition + outNumChars > length()
) with the specified initial numChars
characters in the specified characterString
. Return a reference providing modifiable access to this string. Throw out_of_range
if outPosition > length()
. The behavior is undefined unless characterString
is at least numChars
long.
BSLSTL_STRING_DEFINE_ONLY_CONVERTIBLE_TO_STRINGVIEW_RETURN_TYPE bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::replace | ( | size_type | outPosition, |
size_type | outNumChars, | ||
const STRING_VIEW_LIKE_TYPE & | replacement | ||
) |
Replace the specified outNumChars
characters starting at the specified outPosition
in this string (or the suffix of this string starting at outPosition
if outPosition + outNumChars > length()
) with the specified replacement
, and return a reference providing modifiable access to this string. Throw out_of_range
if outPosition > length()
.
BSLSTL_STRING_DEFINE_ONLY_CONVERTIBLE_TO_STRINGVIEW_RETURN_TYPE bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::replace | ( | size_type | outPosition, |
size_type | outNumChars, | ||
const STRING_VIEW_LIKE_TYPE & | replacement, | ||
size_type | position, | ||
size_type | numChars = npos |
||
) |
Replace the specified outNumChars
characters starting at the specified outPosition
in this string (or the suffix of this string starting at outPosition
if outPosition + outNumChars > length()
) with the optionally specified numChars
characters starting at the specified position
in the specified replacement
(or the suffix of replacement
starting at position
if position + numChars > replacement.length()
). If numChars
is not specified, npos
is used. Return a reference providing modifiable access to this string. Throw out_of_range
if outPosition > length()
or position > replacement.length()
.
basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::replace | ( | size_type | outPosition, |
size_type | outNumChars, | ||
size_type | numChars, | ||
CHAR_TYPE | character | ||
) |
Replace the specified outNumChars
characters starting at the specified outPosition
in this string (or the suffix of this string starting at outPosition
if outPosition + outNumChars > length()
) with the specified numChars
copies of the specified character
. Return a reference providing modifiable access to this string. Throw out_of_range
if outPosition > length()
.
BSLS_PLATFORM_AGGRESSIVE_INLINE void bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::reserve | ( | size_type | newCapacity = 0 | ) |
Change the capacity of this string to the specified newCapacity
. Note that the capacity of a string is the maximum length it can accommodate without reallocation. The actual storage allocated may be higher.
BSLS_PLATFORM_AGGRESSIVE_INLINE void bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::resize | ( | size_type | newLength | ) |
BSLS_PLATFORM_AGGRESSIVE_INLINE void bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::resize | ( | size_type | newLength, |
CHAR_TYPE | character | ||
) |
void bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::resize_and_overwrite | ( | size_type | newLength, |
OPERATION | operation | ||
) |
Change the length of this string to the specified newLength
, erasing characters at the end if newLength < length()
or appending the appropriate number of characters at the end if length() < newLength
. Subsequently, invoke the specified operation
passing the address of the null-terminated buffer and the adjusted length of this string as parameters. Finally, change the length of this string to the value returned by the operation
. Throw length_error
if newLength > max_size()
. The behavior is undefined unless the value returned by the operation
is less than or equal to newLength
.
BSLS_PLATFORM_AGGRESSIVE_INLINE basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::size_type bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::rfind | ( | CHAR_TYPE | character, |
size_type | position = npos |
||
) | const |
Return the position of the last occurrence of the specified character
, if such an occurrence can be found in this string (on or before the optionally specified position
if such a position
is specified), and return npos
otherwise.
BSLS_PLATFORM_AGGRESSIVE_INLINE basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::size_type bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::rfind | ( | const basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & | substring, |
size_type | position = npos |
||
) | const |
Return the starting position of the last occurrence of the specified substring
within this string, if such a sequence can be found in this string (on or before the optionally specified position
if such a position
is specified) using CHAR_TRAITS::eq
to compare characters, and return npos
otherwise.
basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::size_type bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::rfind | ( | const CHAR_TYPE * | characterString, |
size_type | position, | ||
size_type | numChars | ||
) | const |
Return the starting position of the last occurrence of a substring whose value equals that of the specified characterString
of the optionally specified numChars
length, if such a substring can be found in this string (on or before the optionally specified position
if such a position
is specified), and return npos
otherwise. If numChars
is not specified, CHAR_TRAITS::length(characterString)
is used.
BSLS_PLATFORM_AGGRESSIVE_INLINE basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::size_type bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::rfind | ( | const CHAR_TYPE * | characterString, |
size_type | position = npos |
||
) | const |
BSLS_PLATFORM_AGGRESSIVE_INLINE basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::size_type bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::rfind | ( | const STRING_VIEW_LIKE_TYPE & | substring, |
size_type position | BSLSTL_STRING_DEFINE_ONLY_CONVERTIBLE_TO_STRINGVIEW_PARAM_VOID | ||
) | const |
size_type bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::rfind | ( | const STRING_VIEW_LIKE_TYPE & | substring, |
size_type | position = npos BSLSTL_STRING_DECLARE_ONLY_CONVERTIBLE_TO_STRINGVIEW_PARAM_VOID |
||
) | const |
Return the starting position of the last occurrence of the specified substring
within this string, if such a sequence can be found in this string (on or before the optionally specified position
if such a position
is specified) using CHAR_TRAITS::eq
to compare characters, and return npos
otherwise. The behavior is undefined unless the conversion from STRING_VIEW_LIKE_TYPE
to bsl::basic_string_view<CHAR_TYPE, CHAR_TRAITS>
does not throw any exception. Note that this behavior differs from the behavior implemented in the standard container, where the following noexcept specification is used:
BSLS_PLATFORM_AGGRESSIVE_INLINE void bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::shrink_to_fit | ( | ) |
Request the removal of unused capacity by causing reallocation. Note that this method has no effect if the capacity is equal to the size. Also note that if (and only if) reallocation occurs, all iterators, including the past the end iterator, and all references to the elements are invalidated.
|
inline |
Return the length of this string. Note that this number may differ from CHAR_TRAITS::length(c_str())
in case the string contains null characters. Also note that a null-terminating character added by the c_str
method is not counted in this length.
BSLS_PLATFORM_AGGRESSIVE_INLINE bool bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::starts_with | ( | basic_string_view< CHAR_TYPE, CHAR_TRAITS > | characterString | ) | const |
Return true
if the length of this string is equal to or greater than the length of the specified characterString
and the first characterString.length()
characters of this string are equal to the characters of the characterString
, and false
otherwise. CHAR_TRAITS::compare
is used to compare characters. See {Lexicographical Comparisons}.
BSLS_PLATFORM_AGGRESSIVE_INLINE bool bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::starts_with | ( | CHAR_TYPE | character | ) | const |
Return true
if this string contains at least one symbol and the last symbol of this string is equal to the specified character
, and false
otherwise. CHAR_TRAITS::eq
is used to compare characters. See {Lexicographical Comparisons}.
BSLS_PLATFORM_AGGRESSIVE_INLINE bool bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::starts_with | ( | const CHAR_TYPE * | characterString | ) | const |
Return true
if the length of this string is equal to or greater than the length of the specified characterString
and the first CHAR_TRAITS::length(characterString)
characters of this string are equal to the characters of the characterString
, and false
otherwise. CHAR_TRAITS::compare
is used to compare characters. See {Lexicographical Comparisons}.
BSLS_PLATFORM_AGGRESSIVE_INLINE basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::substr | ( | size_type | position = 0 , |
size_type | numChars = npos |
||
) | const |
Return a string whose value is the substring starting at the optionally specified position
in this string, of length the optionally specified numChars
or length() - position
, whichever is smaller. If position
is not specified, 0 is used (i.e., the substring is from the beginning of this string). If numChars
is not specified, npos
is used (i.e., the entire suffix from position
to the end of the string is returned).
|
friend |
String_ClearProctor
is made friend to allow access to internal buffer and length.
|
friend |
Constructs a string with contents equal to the specified value
. The contents of the string will be the same as what std::sprintf(buf, "%d", value)
would produce with a sufficiently large buffer.
|
friend |
Constructs a string with contents equal to the specified value
. The contents of the string will be the same as what std::sprintf(buf, "%lld", value)
would produce with a sufficiently large buffer.
|
friend |
Constructs a string with contents equal to the specified value
. The contents of the string will be the same as what std::sprintf(buf, "%ld", value)
would produce with a sufficiently large buffer.
|
friend |
to_string
functions are made friends to allow access to the internal short string buffer.
Constructs a string with contents equal to the specified value
. The contents of the string will be the same as what std::sprintf(buf, "%llu", value)
would produce with a sufficiently large buffer.
|
friend |
Constructs a string with contents equal to the specified value
. The contents of the string will be the same as what std::sprintf(buf, "%lu", value)
would produce with a sufficiently large buffer.
|
friend |
Constructs a string with contents equal to the specified value
. The contents of the string will be the same as what std::sprintf(buf, "%u", value)
would produce with a sufficiently large buffer.
|
inline |
Exchange the value of this object with that of the specified other
object; also exchange the allocator of this object with that of other
if the (template parameter) type ALLOCATOR
has the propagate_on_container_swap
trait, and do not modify either allocator otherwise. This method provides the no-throw exception-safety guarantee. This operation has O[1]
complexity if either this object was created with the same allocator as other
or ALLOCATOR
has the propagate_on_container_swap
trait; otherwise, it has O[n + m]
complexity, where n
and m
are the lengths of this object and other
, respectively. Note that this methods support for swapping objects created with different allocators when
ALLOCATORdoes not have the
propagate_on_container_swap` trait is a departure from the C++ Standard.
|
static |
Value used to denote "not-a-position", guaranteed to be outside the range [0 .. max_size()]
.