Some compile time help..

Daniel Murphy yebblies at nospamgmail.com
Sun Mar 4 06:51:23 PST 2012


"simendsjo" <simendsjo at gmail.com> wrote in message 
news:op.wanctrbux8p62v at simendsjo-desktop...
> Hi.
> I have the following code:
> void f(Args...)(Args args) {
>   needs_wchar_t(args);
> }
>
> I want to loop over Args, and if it's a string of some type, I want to run 
> it through toUTFz. For all other values, I just want to push them as 
> normal.
> How could I solve this?

With a loop?

void f(Args...)(Args args) {
  foreach(i, T; Args)
  {
    static if (isSomeString!T) args[i] = toUTFz(args[i]);
  }
  needs_wchar_t(args);
}




More information about the Digitalmars-d-learn mailing list