![]() |
Rosetta
2021.16
|
#include <format.h>
Public Member Functions | |
| BasicCStringRef (const Char *s) | |
| template<typename Allocator > | |
| BasicCStringRef (const std::basic_string< Char, std::char_traits< Char >, Allocator > &s) | |
| const Char * | c_str () const |
Private Attributes | |
| const Char * | data_ |
A reference to a null terminated string. It can be constructed from a C string or std::basic_string.
You can use one of the following typedefs for common character types:
+----------—+-----------------------—+ | Type | Definition | +=============+==========================+ | CStringRef | BasicCStringRef<char> | +----------—+-----------------------—+ | WCStringRef | BasicCStringRef<wchar_t> | +----------—+-----------------------—+
This class is most useful as a parameter type to allow passing different types of strings to a function, for example::
template <typename... Args> std::string format(CStringRef format_str, const Args & ... args);
format("{}", 42); format(std::string("{}"), 42);
|
inline |
Constructs a string reference object from a C string.
|
inline |
Constructs a string reference from a std::basic_string object.
|
inline |
Returns the pointer to a C string.
Referenced by fmt::BufferedFile::BufferedFile(), fmt::File::File(), and fmt::BasicFormatter< CharType, ArgFormatter >::format().
|
private |
1.8.7