Specialization of TMP struct T_ZTCharArray for type std::basic_string<TChar>
:
data()
returns zero-terminated strings and is defined const
.const char*
, which implicitly constructs std::string
in turn. This leads to the bad situation that an explicit construction like this: std::string stdString( cString );uses the implicit cast to
const char*
and with that constructs the std::string
. This is of-course very inefficient, as the length of the string has to be determined internally.The most efficient way to create a std::string
object from an object of type CString or AString is to use the explicit constructor:
std::string stdString( String.Buffer(), String.Length() );
TChar | Template parameter providing the underlying character type. Restricted to types enabled by TMP helper struct TT_IsChar . |
Definition at line 171 of file std_characters.hpp.
#include <std_characters.hpp>