I want to pass a QString
variable to a function with const wchar_t*
argument.
Safe solution is:
void foo(const wchar_t*);
QString x = "test";
foo(x.toStdWString().c_str());
but it has overhead of converting to wstring
. Is there any faster solution?
How about this solution? Is it safe and portable?
foo(reinterpret_cast<const wchar_t*>(x.constData()));