Higher level built-in strings

"Jérôme M. Berger" jeberger at free.fr
Tue Jul 20 12:38:58 PDT 2010


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:jeberger at free.fr
http://jeberger.free.fr
Jabber: jeberger at jabber.fr

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: OpenPGP digital signature
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20100720/f61941e3/attachment.pgp>


More information about the Digitalmars-d mailing list