Walter Bright wrote:
> Jérôme M. Berger wrote:
>>     And what about this one:
>>
>> void func(T) (T range) {
>>     foreach (elem; range)
>>         assert (is (typeof (elem) == ElementType!(T)));
>> }
>>
>> func ("azerty");
>> auto a = [ 1, 2, 3, 4, 5];
>> func (a);
> 
> You can specialize the template for strings:
> 
> void func(T:string)(T range) { ... }

        Sure, i can also not use a template and write however many
overloaded functions I need. So what are templates for?

                Jerome
-- 
mailto:jeber...@free.fr
http://jeberger.free.fr
Jabber: jeber...@jabber.fr

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to