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.

Synopsis

Declared in <bslstl_stringrefdata.h>

template<class CHAR_TYPE>
class StringRefData
    : public bsl::basic_string_view<CHAR_TYPE>

Base Classes

Name

Description

bsl::basic_string_view<CHAR_TYPE>

A non‐owning reference to a string.

Type Aliases

Name

size_type

Member Functions

Name

Description

StringRefData [constructor]

Constructors

operator BloombergLP::bslmf::NestedTraitDeclaration<StringRefData, is_trivially_copyable>

Declare StringRefData as trivially copyable.

Static Member Functions

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.

Derived Classes

Name

Description

StringRefImp<char>

StringRefImp<wchar_t>

StringRefImp

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.

Created with MrDocs