On 09/25/2014 05:40 AM, Steven Schveighoffer wrote:

> On 9/23/14 7:12 PM, Ali Çehreli wrote:
>
>> Can we get rid of the ResultT template parameter? Tricks with variadic
>> templates, the with statement, etc. come to mind but I could not
>> manage it.
>
> I don't think so.

Me neither. :) This question made me aware of a distinction in template use cases.

- Templates are mostly for generic algorithms as in "This code will work with any type, value, etc."

- The yield() template in my example was not about genericity: I wanted to instantiate that template with only one type (which currently has to be provided by the user). So, I wanted to take advantage of the template type deduction to detect a type from inside the user's code.

Not a big deal at all.

Ali

Reply via email to