Provide a non-owning reference to a contiguous character sequence.
Declared in <bslstl_stringref.h>
template<class CHAR_TYPE>
class StringRefImp
: public StringRefData<CHAR_TYPE>
This class provides a reference-semantic-like (see below) mechanism that allows const std::string values, which are represented externally as either an std::string or null-terminated c-style string (or parts thereof), to be treated both uniformly and efficiently when passed as an argument to a function in which the string's length will be needed. The interface of this class provides a subset of accessor methods found on std::string (but none of the manipulators) -- all of which apply to the referenced string. But, because only non-modifiable access is afforded to the referenced string value, each of the manipulators on this type -- assignment in particular -- apply to this string-reference object itself (as if it had pointer semantics). Hence, this class has a hybrid of reference- and pointer-semantics.
This class: * supports a complete set of value-semantic operations
except for bdex serialization * is exception-neutral (agnostic) * is alias-safe * is const thread-safe For terminology see bsldoc_glossary.
| Name | Description |
|---|---|
StringRefData<CHAR_TYPE> | This class is an intermediate link between bslstl::StringRef used in BDE and bsl::string_view and is kept only for compatibility with legacy code. |
| Name | Description |
|---|---|
const_iterator | Alias for a constant iterator over the characters of this ref. |
const_reference | This typedef is an alias to reference. |
const_reverse_iterator | This typedef is an alias to bsl::reverse_iterator<const_iterator>. |
difference_type | This typedef is an alias to std::ptrdiff_t. |
iterator | This typedef is an alias to value_type const *. |
reference | This typedef is an alias to value_type const&. |
size_type | Standard Library general container requirements. |
value_type | Alias for a constant character type stored in this string ref. |
| Name | Description |
|---|---|
StringRefImp [constructor] | Constructors |
assign | assign overloads |
begin | Return an iterator to the first character of the referenced string. |
compare | Lexicographically compare this string with other. |
data | Return a pointer to the first character of the referenced string. |
empty | Return true if this string reference is empty. |
end | Return an iterator past the last character of the referenced string. |
isEmpty | Return true if this object represents an empty string value, and false otherwise. This object represents an empty string value if begin() == end(). |
length | Return the length of the string referred to by this object. Note that this call is equivalent to end() - begin(). |
operator[] | Return a reference to the character at the specified index. |
rbegin | Return a reverse iterator to the last character of the string. |
rend | Return a reverse iterator before the first character of the string. |
reset | Reset this string reference to the empty default-constructed state. |
size | Return the number of characters in the string referred to by this object. Note that this call is equivalent to end() - begin(). |
operator BloombergLP::bslmf::NestedTraitDeclaration<StringRefData, is_trivially_copyable> | Nested trait declaration for bsl::is_trivially_copyable. |
operator BloombergLP::bslmf::NestedTraitDeclaration<StringRefImp, is_trivially_copyable> | Nested trait declaration for bsl::is_trivially_copyable. |
operator std::basic_string<CHAR_TYPE> | Return an std::basic_string (synonymous with std::basic_string) having the value of the string bound to this string reference. |
| Name | Description |
|---|---|
cStringLength | Return the number of CHAR_TYPE characters in the specified null-terminated data string, up to but not including the terminal null value. |
| Name | Description |
|---|---|
operator+ | Return the concatenation of the specified lhs string ref and the specified rhs std::basic_string value. |
operator+ | Return a bsl::string having the value of the concatenation of the strings referred to by the specified lhs and rhs values. |
operator+ | Return the concatenation of the specified lhs string ref and the specified rhs bsl::basic_string value. |
operator+ | Return the concatenation of the specified string ref and C string. |
| Name | Description |
|---|---|
| CHAR_TYPE | character type of the referenced character sequence. |