Hey all,
Can someone please explain to me how and why it is that
toStringz() and toUTFz() can be used in the following way?
string a = "123";
auto b = a.toStringz;
auto c = a.toUTFz;
Also, how is it that they can even be called as if they were
class methods? That is:
string a = "123";
auto b = a.toStringz(); // <-- Note I've added parentheses
auto c = a.toUTFz();
As opposed to being limited to:
string a = "123";
auto b = toStringz(a);
auto c = toUTFz(a);
I need to understand this, as I wish to write a function
toWinStr() that can be used in the same way which will accept any
string type, and, based on something like version(Unicode) and
const-ness, output a WinAPI LPSTR, LPCSTR, LPWSTR or LPCWSTR as
appropriate.
Is such a thing possible?