wcharPtr

Replaces std.utf.toUTFz with a version that uses the stack as long as the required bytes for the output are <= 1k. Longer strings use malloc to create a buffer for the conversion. It is freed at least at the end of the scope.

  1. auto wcharPtr(void* buffer)
  2. immutable(wchar)* wcharPtr()
    @nogc nothrow
    immutable(wchar)*
    wcharPtr
    (
    alias wstr
    )
    ()
    if (
    is(typeof(wstr) == wstring) &&
    __traits(compiles, )
    )

Examples

string text = "Hello, world!";
WinApiW(wcharPtr!text);

See Also

toWstring

Meta