Higher level built-in strings
"Jérôme M. Berger"
jeberger at free.fr
Tue Jul 20 09:50:53 PDT 2010
Sean Kelly wrote:
> Steven Schveighoffer Wrote:
>> How do we make this work?
>>
>> auto str = "hello world";
>> foreach(c; str)
>> assert(is(typeof(c) == dchar));
>
> foreach (dchar c; str)
> assert(...);
>
> This feature has been in D for years.
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);
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/1c60026f/attachment.pgp>
More information about the Digitalmars-d
mailing list