I have a question how I could combine template parameters deduction with setting default values for template parameters. I will start directly from a piece of code.

string decodeURICustom(string allowedSpecChars = null, bool formEncoding = false, T)(T source) pure
{
   //Some processing
}

I want parameter T be deduced from context (T will be string, dstring, etc)
And then I want to add some aliases with specialised arguments.

alias decodeURICustom!("!$&'()*+,;=") decodeURIHost;
alias encodeURICustom!("!$&'()*+,;=") encodeURIHost;

alias decodeURICustom!("!$&'()*+,;=:@/") decodeURIPath;
alias encodeURICustom!("!$&'()*+,;=:@/") encodeURIPath;

But when using decodeURICustom template directly I want to be able not set template arguments.

void main()
{
  string str = "http://www.dlang.org";;
  string result = decodeURICustom(str);
}

How could I do this? Is it possible. The example above doesn't complie.

Of course I could create another template function.

string decodeURIHost(T)(T source)
{

}

Reply via email to