On Sunday, 23 March 2014 at 11:15:13 UTC, Andrej Mitrovic wrote:
On 3/23/14, Uranuz <neura...@gmail.com> wrote:
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.
You can use eponymous templates for this. E.g.:
-----
template decodeURICustom(string allowedSpecChars = null, bool
formEncoding = false)
{
string decodeURICustom(T)(T source) pure
{
return "";
}
}
alias decodeURICustom!("!$&'()*+,;=") decodeURIHost;
void main()
{
string str = "http://www.dlang.org";
string result = decodeURICustom(str);
}
-----
Yes. I like it more that ivoking one function from another. But
this trick not working in DMD 2.063 as I understand.