BDE 4.14.0 Production release
|
#include <bslstl_stringview.h>
Public Types | |
typedef CHAR_TRAITS | traits_type |
typedef CHAR_TYPE | value_type |
typedef value_type * | pointer |
typedef const value_type * | const_pointer |
typedef value_type & | reference |
typedef const value_type & | const_reference |
typedef const value_type * | const_iterator |
typedef const_iterator | iterator |
typedef bsl::reverse_iterator< iterator > | reverse_iterator |
typedef bsl::reverse_iterator< const_iterator > | const_reverse_iterator |
typedef std::size_t | size_type |
typedef std::ptrdiff_t | difference_type |
Static Public Attributes | |
static const size_type | npos = ~size_type(0) |
This class template provides an STL-compliant string_view . This implementation offers strong exception guarantees (see below), with the general rule that any method that attempts to access a position outside the valid range of a string_view throws std::out_of_range
.
Note that the search methods, such as find
, rfind
, etc, do not actually access invalid positions, so they do not throw exceptions.
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.
typedef const value_type* bsl::basic_string_view< CHAR_TYPE, CHAR_TRAITS >::const_iterator |
typedef const value_type* bsl::basic_string_view< CHAR_TYPE, CHAR_TRAITS >::const_pointer |
typedef const value_type& bsl::basic_string_view< CHAR_TYPE, CHAR_TRAITS >::const_reference |
typedef bsl::reverse_iterator<const_iterator> bsl::basic_string_view< CHAR_TYPE, CHAR_TRAITS >::const_reverse_iterator |
typedef std::ptrdiff_t bsl::basic_string_view< CHAR_TYPE, CHAR_TRAITS >::difference_type |
typedef const_iterator bsl::basic_string_view< CHAR_TYPE, CHAR_TRAITS >::iterator |
typedef value_type* bsl::basic_string_view< CHAR_TYPE, CHAR_TRAITS >::pointer |
typedef value_type& bsl::basic_string_view< CHAR_TYPE, CHAR_TRAITS >::reference |
typedef bsl::reverse_iterator<iterator> bsl::basic_string_view< CHAR_TYPE, CHAR_TRAITS >::reverse_iterator |
typedef std::size_t bsl::basic_string_view< CHAR_TYPE, CHAR_TRAITS >::size_type |
typedef CHAR_TRAITS bsl::basic_string_view< CHAR_TYPE, CHAR_TRAITS >::traits_type |
typedef CHAR_TYPE bsl::basic_string_view< CHAR_TYPE, CHAR_TRAITS >::value_type |
|
inline |
|
default |
Create a view that has the same value as the specified original
object.
BSLS_PLATFORM_AGGRESSIVE_INLINE BSLS_KEYWORD_CONSTEXPR_CPP17 bsl::basic_string_view< CHAR_TYPE, CHAR_TRAITS >::basic_string_view | ( | const CHAR_TYPE * | characterString | ) |
Create a view of the specified null-terminated characterString
(of length CHAR_TRAITS::length(characterString)
).
BSLS_PLATFORM_AGGRESSIVE_INLINE BSLS_KEYWORD_CONSTEXPR_CPP14 bsl::basic_string_view< CHAR_TYPE, CHAR_TRAITS >::basic_string_view | ( | const CHAR_TYPE * | characterString, |
size_type | numChars | ||
) |
Create a view that has the same value as the subview of the optionally specified numChars
length starting at the beginning of the specified characterString
. The behavior is undefined unless characterString || (numChars == 0)
and numChars <= max_size()
.
BSLS_KEYWORD_CONSTEXPR_CPP14 bsl::basic_string_view< CHAR_TYPE, CHAR_TRAITS >::basic_string_view | ( | CONTG_ITER | first, |
SENTINEL | last, | ||
typename bsl::enable_if< BasicStringView_IsCompatibleIterator< CHAR_TYPE, CONTG_ITER >::value &&BasicStringView_IsCompatibleSentinel< SENTINEL >::value >::type * | = 0 |
||
) |
Create a view from of characters in the range starting at the specified first
, a contiguous iterator, to the position immediately before the specified end
, a sentinel type. The behavior is undefined unless:
[first, last)
is a contiguous valid range, o if first
is 0, then 0 == last - first
, and *o the SENTINEL
type is *not convertible to std::size_t
. Note that contiguous iterator types also provide random access. Also note that pointers to CHAR_TYPE
can be used as iterator and sentinel types. bsl::basic_string_view< CHAR_TYPE, CHAR_TRAITS >::basic_string_view | ( | const std::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & | str | ) |
|
default |
BSLS_PLATFORM_AGGRESSIVE_INLINE BSLS_KEYWORD_CONSTEXPR_CPP14 bsl::basic_string_view< CHAR_TYPE, CHAR_TRAITS >::basic_string_view | ( | CONTG_ITER | first, |
SENTINEL | last, | ||
typename bsl::enable_if< BasicStringView_IsCompatibleIterator< CHAR_TYPE, CONTG_ITER >::value &&BasicStringView_IsCompatibleSentinel< SENTINEL >::value >::type * | |||
) |
BSLS_PLATFORM_AGGRESSIVE_INLINE bsl::basic_string_view< CHAR_TYPE, CHAR_TRAITS >::basic_string_view | ( | const std::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & | str | ) |
BSLS_PLATFORM_AGGRESSIVE_INLINE BSLS_KEYWORD_CONSTEXPR_CPP14 basic_string_view< CHAR_TYPE, CHAR_TRAITS >::const_reference bsl::basic_string_view< CHAR_TYPE, CHAR_TRAITS >::at | ( | size_type | position | ) | const |
Return a reference providing non-modifiable access to the character at the specified position
in this view. Throw std::out_of_range
if position >= length()
.
|
inline |
Return a reference providing non-modifiable access to the character at the last position in this view. The behavior is undefined if this view is empty. Note that the last position is length() - 1
.
|
inline |
Return an iterator providing non-modifiable access to the first character of this view (or the past-the-end iterator if this view is empty).
bsl::basic_string_view< CHAR_TYPE, CHAR_TRAITS >::BSLMF_NESTED_TRAIT_DECLARATION | ( | basic_string_view< CHAR_TYPE, CHAR_TRAITS > | , |
bsl::is_trivially_copyable | |||
) |
|
inline |
|
inline |
BSLS_PLATFORM_AGGRESSIVE_INLINE BSLS_KEYWORD_CONSTEXPR_CPP17 int bsl::basic_string_view< CHAR_TYPE, CHAR_TRAITS >::compare | ( | basic_string_view< CHAR_TYPE, CHAR_TRAITS > | other | ) | const |
Lexicographically compare this view with the specified other
view, and return a negative value if this view is less than other
, a positive value if it is greater than other
, and 0 in case of equality. See {Lexicographical Comparisons}.
BSLS_PLATFORM_AGGRESSIVE_INLINE BSLS_KEYWORD_CONSTEXPR_CPP14 int bsl::basic_string_view< CHAR_TYPE, CHAR_TRAITS >::compare | ( | const CHAR_TYPE * | other | ) | const |
Lexicographically compare this view with the specified null-terminated other
string (of length CHAR_TRAITS::length(other)
), and return a negative value if this view is less than other
, a positive value if it is greater than other
, and 0 in case of equality. The behavior is undefined unless other
is a null-terminated string.
BSLS_PLATFORM_AGGRESSIVE_INLINE BSLS_KEYWORD_CONSTEXPR_CPP14 int bsl::basic_string_view< CHAR_TYPE, CHAR_TRAITS >::compare | ( | size_type | lhsPosition, |
size_type | lhsNumChars, | ||
basic_string_view< CHAR_TYPE, CHAR_TRAITS > | other, | ||
size_type | otherPosition, | ||
size_type | otherNumChars | ||
) | const |
Lexicographically compare the subview of this view of the specified lhsNumChars
length starting at the specified lhsPosition
(or the suffix of this view starting at lhsPosition
if lhsPosition + lhsNumChars > length()
) with the subview of the specified other
view of the specified otherNumChars
length starting at the specified otherPosition
(or the suffix of other
starting at otherPosition
if otherPosition + otherNumChars > other.length()
). Return a negative value if the indicated subview of this view is less than the indicated subview of other
, a positive value if it is greater than the indicated subview of other
, and 0 in case of equality. Throw std::out_of_range
if lhsPosition > length()
or otherPosition > other.length()
. See {Lexicographical Comparisons}.
BSLS_PLATFORM_AGGRESSIVE_INLINE BSLS_KEYWORD_CONSTEXPR_CPP14 int bsl::basic_string_view< CHAR_TYPE, CHAR_TRAITS >::compare | ( | size_type | lhsPosition, |
size_type | lhsNumChars, | ||
const CHAR_TYPE * | other | ||
) | const |
Lexicographically compare the subview of this view of the specified lhsNumChars
length starting at the specified lhsPosition
(or the suffix of this view 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 subview of this view is less than other
, a positive value if it is greater than other
, and 0 in case of equality. Throw std::out_of_range
if lhsPosition > length()
.
BSLS_PLATFORM_AGGRESSIVE_INLINE BSLS_KEYWORD_CONSTEXPR_CPP14 int bsl::basic_string_view< CHAR_TYPE, CHAR_TRAITS >::compare | ( | size_type | lhsPosition, |
size_type | lhsNumChars, | ||
const CHAR_TYPE * | other, | ||
size_type | otherNumChars | ||
) | const |
Lexicographically compare the subview of this view of the specified lhsNumChars
length starting at the specified lhsPosition
(or the suffix of this view 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 subview of this view 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 std::out_of_range
if lhsPosition > length()
. The behavior is undefined unless other || 0 == otherNumChars
.
BSLS_PLATFORM_AGGRESSIVE_INLINE BSLS_KEYWORD_CONSTEXPR_CPP14 int bsl::basic_string_view< CHAR_TYPE, CHAR_TRAITS >::compare | ( | size_type | position, |
size_type | numChars, | ||
basic_string_view< CHAR_TYPE, CHAR_TRAITS > | other | ||
) | const |
Lexicographically compare the subview of this view of the specified numChars
length starting at the specified position
(or the suffix of this view starting at position
if position + numChars > length()
) with the specified other
view, and return a negative value if the indicated subview of this view is less than other
, a positive value if it is greater than other
, and 0 in case of equality. Throw std::out_of_range
if position > length()
. See {Lexicographical Comparisons}.
basic_string_view< CHAR_TYPE, CHAR_TRAITS >::size_type bsl::basic_string_view< CHAR_TYPE, CHAR_TRAITS >::copy | ( | CHAR_TYPE * | characterString, |
size_type | numChars, | ||
size_type | position = 0 |
||
) | const |
Copy from this view, 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 std::out_of_range
if position > length()
. Note that the output characterString
is not null-terminated. The behavior is undefined unless characterString
has enough room to hold at least numChars
or length() - position
, whichever is smaller, and the characterString
does not lie within the source range to be copied.
|
inline |
BSLS_PLATFORM_AGGRESSIVE_INLINE BSLS_KEYWORD_CONSTEXPR_CPP17 basic_string_view< CHAR_TYPE, CHAR_TRAITS >::const_reverse_iterator bsl::basic_string_view< CHAR_TYPE, CHAR_TRAITS >::crend | ( | ) | const |
|
inline |
Return an address providing non-modifiable access to the underlying character array. Note that this array may be not null-terminated.
|
inline |
|
inline |
BSLS_PLATFORM_AGGRESSIVE_INLINE BSLS_KEYWORD_CONSTEXPR_CPP17 bool bsl::basic_string_view< CHAR_TYPE, CHAR_TRAITS >::ends_with | ( | basic_string_view< CHAR_TYPE, CHAR_TRAITS > | subview | ) | const |
Return true
if this view ends with the specified subview
, and false
otherwise. See {Lexicographical Comparisons}.
BSLS_PLATFORM_AGGRESSIVE_INLINE BSLS_KEYWORD_CONSTEXPR bool bsl::basic_string_view< CHAR_TYPE, CHAR_TRAITS >::ends_with | ( | CHAR_TYPE | character | ) | const |
BSLS_PLATFORM_AGGRESSIVE_INLINE BSLS_KEYWORD_CONSTEXPR_CPP17 bool bsl::basic_string_view< CHAR_TYPE, CHAR_TRAITS >::ends_with | ( | const CHAR_TYPE * | characterString | ) | const |
Return true
if this view ends with the specified characterString
, and false
otherwise.
BSLS_PLATFORM_AGGRESSIVE_INLINE BSLS_KEYWORD_CONSTEXPR_CPP14 basic_string_view< CHAR_TYPE, CHAR_TRAITS >::size_type bsl::basic_string_view< CHAR_TYPE, CHAR_TRAITS >::find | ( | basic_string_view< CHAR_TYPE, CHAR_TRAITS > | subview, |
size_type | position = 0 |
||
) | const |
Return the starting position of the first occurrence of the specified subview
, if it can be found in this view (on or after the optionally specified position
) using CHAR_TRAITS::eq
to compare characters, and return npos
otherwise.
BSLS_PLATFORM_AGGRESSIVE_INLINE BSLS_KEYWORD_CONSTEXPR_CPP14 basic_string_view< CHAR_TYPE, CHAR_TRAITS >::size_type bsl::basic_string_view< CHAR_TYPE, CHAR_TRAITS >::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 view (on or after the optionally specified position
if such a position
is specified), and return npos
otherwise.
BSLS_PLATFORM_AGGRESSIVE_INLINE BSLS_KEYWORD_CONSTEXPR_CPP14 basic_string_view< CHAR_TYPE, CHAR_TRAITS >::size_type bsl::basic_string_view< CHAR_TYPE, CHAR_TRAITS >::find | ( | const CHAR_TYPE * | characterString, |
size_type | position, | ||
size_type | numChars | ||
) | const |
Return the starting position of the first occurrence of the specified characterString
of the specified numChars
length, if such a string can be found in this view (on or after the specified position
) using CHAR_TRAITS::eq
to compare characters, and return npos
otherwise. The behavior is undefined unless characterString || (numChars == 0)
.
BSLS_PLATFORM_AGGRESSIVE_INLINE BSLS_KEYWORD_CONSTEXPR_CPP17 basic_string_view< CHAR_TYPE, CHAR_TRAITS >::size_type bsl::basic_string_view< CHAR_TYPE, CHAR_TRAITS >::find | ( | const CHAR_TYPE * | characterString, |
size_type | position = 0 |
||
) | const |
Return the starting position of the first occurrence of the specified null-terminated characterString
, if such a string can be found in this view (on or after the optionally specified position
) using CHAR_TRAITS::eq
to compare characters, and return npos
otherwise.
BSLS_PLATFORM_AGGRESSIVE_INLINE BSLS_KEYWORD_CONSTEXPR_CPP14 basic_string_view< CHAR_TYPE, CHAR_TRAITS >::size_type bsl::basic_string_view< CHAR_TYPE, CHAR_TRAITS >::find_first_not_of | ( | basic_string_view< CHAR_TYPE, CHAR_TRAITS > | subview, |
size_type | position = 0 |
||
) | const |
Return the position of the first occurrence of a character not belonging to the specified subview
, if such an occurrence can be found in this view (on or after the optionally specified position
if such a position
is specified), and return npos
otherwise.
BSLS_PLATFORM_AGGRESSIVE_INLINE BSLS_KEYWORD_CONSTEXPR_CPP14 basic_string_view< CHAR_TYPE, CHAR_TRAITS >::size_type bsl::basic_string_view< CHAR_TYPE, CHAR_TRAITS >::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 view (on or after the optionally specified position
if such a position
is specified), and return npos
otherwise.
BSLS_PLATFORM_AGGRESSIVE_INLINE BSLS_KEYWORD_CONSTEXPR_CPP14 basic_string_view< CHAR_TYPE, CHAR_TRAITS >::size_type bsl::basic_string_view< CHAR_TYPE, CHAR_TRAITS >::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 specified numChars
length, if such an occurrence can be found in this view (on or after the specified position
) using CHAR_TRAITS::eq
to compare characters, and return npos
otherwise. The behavior is undefined unless characterString || (numChars == 0)
.
BSLS_PLATFORM_AGGRESSIVE_INLINE BSLS_KEYWORD_CONSTEXPR_CPP17 basic_string_view< CHAR_TYPE, CHAR_TRAITS >::size_type bsl::basic_string_view< CHAR_TYPE, CHAR_TRAITS >::find_first_not_of | ( | const CHAR_TYPE * | 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 view (on or after the optionally specified position
), and return npos
otherwise.
BSLS_PLATFORM_AGGRESSIVE_INLINE BSLS_KEYWORD_CONSTEXPR_CPP14 basic_string_view< CHAR_TYPE, CHAR_TRAITS >::size_type bsl::basic_string_view< CHAR_TYPE, CHAR_TRAITS >::find_first_of | ( | basic_string_view< CHAR_TYPE, CHAR_TRAITS > | subview, |
size_type | position = 0 |
||
) | const |
Return the position of the first occurrence of a character belonging to the specified subview
, if such an occurrence can be found in this view (on or after the optionally specified position
if such a position
is specified), and return npos
otherwise.
BSLS_PLATFORM_AGGRESSIVE_INLINE BSLS_KEYWORD_CONSTEXPR_CPP14 basic_string_view< CHAR_TYPE, CHAR_TRAITS >::size_type bsl::basic_string_view< CHAR_TYPE, CHAR_TRAITS >::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 view (on or after the optionally specified position
if such a position
is specified), and return npos
otherwise.
BSLS_PLATFORM_AGGRESSIVE_INLINE BSLS_KEYWORD_CONSTEXPR_CPP14 basic_string_view< CHAR_TYPE, CHAR_TRAITS >::size_type bsl::basic_string_view< CHAR_TYPE, CHAR_TRAITS >::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 specified numChars
length, if such a string can be found in this view (on or after the specified position
) using CHAR_TRAITS::eq
to compare characters, and return npos
otherwise. The behavior is undefined unless characterString || (numChars == 0)
.
BSLS_PLATFORM_AGGRESSIVE_INLINE BSLS_KEYWORD_CONSTEXPR_CPP17 basic_string_view< CHAR_TYPE, CHAR_TRAITS >::size_type bsl::basic_string_view< CHAR_TYPE, CHAR_TRAITS >::find_first_of | ( | const CHAR_TYPE * | 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 view (on or after the optionally specified position
), and return npos
otherwise.
BSLS_PLATFORM_AGGRESSIVE_INLINE BSLS_KEYWORD_CONSTEXPR_CPP14 basic_string_view< CHAR_TYPE, CHAR_TRAITS >::size_type bsl::basic_string_view< CHAR_TYPE, CHAR_TRAITS >::find_last_not_of | ( | basic_string_view< CHAR_TYPE, CHAR_TRAITS > | subview, |
size_type | position = npos |
||
) | const |
Return the position of the last occurrence of a character not belonging to the specified subview
, if such an occurrence can be found in this view (on or before the optionally specified position
if such a position
is specified), and return npos
otherwise.
BSLS_PLATFORM_AGGRESSIVE_INLINE BSLS_KEYWORD_CONSTEXPR_CPP14 basic_string_view< CHAR_TYPE, CHAR_TRAITS >::size_type bsl::basic_string_view< CHAR_TYPE, CHAR_TRAITS >::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 view (on or before the optionally specified position
if such a position
is specified), and return npos
otherwise.
BSLS_PLATFORM_AGGRESSIVE_INLINE BSLS_KEYWORD_CONSTEXPR_CPP14 basic_string_view< CHAR_TYPE, CHAR_TRAITS >::size_type bsl::basic_string_view< CHAR_TYPE, CHAR_TRAITS >::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 specified numChars
length, if such an occurrence can be found in this view (on or after the specified position
) using CHAR_TRAITS::eq
to compare characters, and return npos
otherwise. The behavior is undefined unless characterString || (numChars == 0)
.
BSLS_PLATFORM_AGGRESSIVE_INLINE BSLS_KEYWORD_CONSTEXPR_CPP17 basic_string_view< CHAR_TYPE, CHAR_TRAITS >::size_type bsl::basic_string_view< CHAR_TYPE, CHAR_TRAITS >::find_last_not_of | ( | const CHAR_TYPE * | 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 view (on or after the optionally specified position
), and return npos
otherwise.
BSLS_PLATFORM_AGGRESSIVE_INLINE BSLS_KEYWORD_CONSTEXPR_CPP14 basic_string_view< CHAR_TYPE, CHAR_TRAITS >::size_type bsl::basic_string_view< CHAR_TYPE, CHAR_TRAITS >::find_last_of | ( | basic_string_view< CHAR_TYPE, CHAR_TRAITS > | subview, |
size_type | position = npos |
||
) | const |
Return the position of the last occurrence of a character belonging to the specified subview
, if such an occurrence can be found in this view (on or before the optionally specified position
if such a position
is specified), and return npos
otherwise.
BSLS_PLATFORM_AGGRESSIVE_INLINE BSLS_KEYWORD_CONSTEXPR_CPP14 basic_string_view< CHAR_TYPE, CHAR_TRAITS >::size_type bsl::basic_string_view< CHAR_TYPE, CHAR_TRAITS >::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 view (on or before the optionally specified position
if such a position
is specified), and return npos
otherwise.
BSLS_PLATFORM_AGGRESSIVE_INLINE BSLS_KEYWORD_CONSTEXPR_CPP14 basic_string_view< CHAR_TYPE, CHAR_TRAITS >::size_type bsl::basic_string_view< CHAR_TYPE, CHAR_TRAITS >::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 specified numChars
length, if such a string can be found in this view (on or after the specified position
) using CHAR_TRAITS::eq
to compare characters, and return npos
otherwise. The behavior is undefined unless characterString || (numChars == 0)
.
BSLS_PLATFORM_AGGRESSIVE_INLINE BSLS_KEYWORD_CONSTEXPR_CPP17 basic_string_view< CHAR_TYPE, CHAR_TRAITS >::size_type bsl::basic_string_view< CHAR_TYPE, CHAR_TRAITS >::find_last_of | ( | const CHAR_TYPE * | 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 view (on or after the optionally specified position
), and return npos
otherwise.
|
inline |
Return a reference providing non-modifiable access to the character at the first position in this view. The behavior is undefined if this view is empty.
|
inline |
|
inline |
Return the maximal possible length of this view. Note that requests to create a view longer than this number of characters are guaranteed to raise an std::length_error
exception.
|
inline |
Convert this const
object to a string type native to the compiler`s library, instantiated with the same character type and traits type. The return string will contain the same sequence of characters as this object and will have a default-constructed allocator.
|
default |
Assign to this view the value of the specified rhs
object, and return a reference providing modifiable access to this view.
BSLS_KEYWORD_CONSTEXPR_CPP14 basic_string_view & bsl::basic_string_view< CHAR_TYPE, CHAR_TRAITS >::operator= | ( | const std::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & | rhs | ) |
Assign to this view the value of the specified rhs
object, and return a reference providing modifiable access to this view.
BSLS_PLATFORM_AGGRESSIVE_INLINE BSLS_KEYWORD_CONSTEXPR_CPP14 basic_string_view< CHAR_TYPE, CHAR_TRAITS > & bsl::basic_string_view< CHAR_TYPE, CHAR_TRAITS >::operator= | ( | const std::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > & | rhs | ) |
|
inline |
Return a reference providing non-modifiable access to the character at the specified position
in this view. The behavior is undefined unless position < length()
.
|
inline |
Return a reverse iterator providing non-modifiable access to the last character of this view (or the past-the-end reverse iterator if this view is empty).
BSLS_KEYWORD_CONSTEXPR_CPP14 void bsl::basic_string_view< CHAR_TYPE, CHAR_TRAITS >::remove_prefix | ( | size_type | numChars | ) |
Move the start of this view forward by the specified numChars
. The behavior is undefined unless numChars <= length()
.
BSLS_KEYWORD_CONSTEXPR_CPP14 void bsl::basic_string_view< CHAR_TYPE, CHAR_TRAITS >::remove_suffix | ( | size_type | numChars | ) |
Move the end of this view back by the specified numChars
. The behavior is undefined unless numChars <= length()
.
BSLS_PLATFORM_AGGRESSIVE_INLINE BSLS_KEYWORD_CONSTEXPR_CPP17 basic_string_view< CHAR_TYPE, CHAR_TRAITS >::const_reverse_iterator bsl::basic_string_view< CHAR_TYPE, CHAR_TRAITS >::rend | ( | ) | const |
BSLS_PLATFORM_AGGRESSIVE_INLINE BSLS_KEYWORD_CONSTEXPR_CPP14 basic_string_view< CHAR_TYPE, CHAR_TRAITS >::size_type bsl::basic_string_view< CHAR_TYPE, CHAR_TRAITS >::rfind | ( | basic_string_view< CHAR_TYPE, CHAR_TRAITS > | subview, |
size_type | position = npos |
||
) | const |
Return the starting position of the last occurrence of the specified subview
within this view, if such a sequence can be found in this view (on or before the optionally specified position
if such a position
is specified) using CHAR_TRAITS::eq
to compare characters, and return npos
otherwise.
BSLS_PLATFORM_AGGRESSIVE_INLINE BSLS_KEYWORD_CONSTEXPR_CPP14 basic_string_view< CHAR_TYPE, CHAR_TRAITS >::size_type bsl::basic_string_view< CHAR_TYPE, CHAR_TRAITS >::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 view (on or before the optionally specified position
if such a position
is specified), and return npos
otherwise.
BSLS_PLATFORM_AGGRESSIVE_INLINE BSLS_KEYWORD_CONSTEXPR_CPP14 basic_string_view< CHAR_TYPE, CHAR_TRAITS >::size_type bsl::basic_string_view< CHAR_TYPE, CHAR_TRAITS >::rfind | ( | const CHAR_TYPE * | characterString, |
size_type | position, | ||
size_type | numChars | ||
) | const |
Return the starting position of the last occurrence of the specified characterString
of the specified numChars
length, if such a string can be found in this view (on or after the specified position
) using CHAR_TRAITS::eq
to compare characters, and return npos
otherwise. The behavior is undefined unless characterString || (numChars == 0)
.
BSLS_PLATFORM_AGGRESSIVE_INLINE BSLS_KEYWORD_CONSTEXPR_CPP14 basic_string_view< CHAR_TYPE, CHAR_TRAITS >::size_type bsl::basic_string_view< CHAR_TYPE, CHAR_TRAITS >::rfind | ( | const CHAR_TYPE * | characterString, |
size_type | position = npos |
||
) | const |
Return the starting position of the last occurrence of the specified null-terminated characterString
, if such a string can be found in this view (on or after the optionally specified position
) using CHAR_TRAITS::eq
to compare characters, and return npos
otherwise.
|
inline |
BSLS_PLATFORM_AGGRESSIVE_INLINE BSLS_KEYWORD_CONSTEXPR_CPP17 bool bsl::basic_string_view< CHAR_TYPE, CHAR_TRAITS >::starts_with | ( | basic_string_view< CHAR_TYPE, CHAR_TRAITS > | subview | ) | const |
Return true
if this view starts with the specified subview
, and false
otherwise. See {Lexicographical Comparisons}.
BSLS_PLATFORM_AGGRESSIVE_INLINE BSLS_KEYWORD_CONSTEXPR bool bsl::basic_string_view< CHAR_TYPE, CHAR_TRAITS >::starts_with | ( | CHAR_TYPE | character | ) | const |
Return true
if this view starts with the specified character
, and false
otherwise.
BSLS_PLATFORM_AGGRESSIVE_INLINE BSLS_KEYWORD_CONSTEXPR_CPP17 bool bsl::basic_string_view< CHAR_TYPE, CHAR_TRAITS >::starts_with | ( | const CHAR_TYPE * | characterString | ) | const |
Return true
if this view starts with the specified characterString
, and false
otherwise.
BSLS_PLATFORM_AGGRESSIVE_INLINE BSLS_KEYWORD_CONSTEXPR_CPP14 basic_string_view< CHAR_TYPE, CHAR_TRAITS > bsl::basic_string_view< CHAR_TYPE, CHAR_TRAITS >::substr | ( | size_type | position = 0 , |
size_type | numChars = npos |
||
) | const |
Return a view whose value is the subview starting at the optionally specified position
in this view, of length the optionally specified numChars
or length() - position
, whichever is smaller. If position
is not specified, 0 is used (i.e., the subview is from the beginning of this view). If numChars
is not specified, npos
is used (i.e., the entire suffix from position
to the end of the view is returned). Throw std::out_of_range
if position > length()
.
void bsl::basic_string_view< CHAR_TYPE, CHAR_TRAITS >::swap | ( | basic_string_view< CHAR_TYPE, CHAR_TRAITS > & | other | ) |
Exchange the value of this view with the value of the specified other
object.
|
static |
Value used to denote "not-a-position", guaranteed to be outside the range [0 .. max_size()]
.