Higher level built-in strings
Aelxx
aelxx at yandex.ru
Wed Jul 21 05:13:30 PDT 2010
"Walter Bright" <newshound2 at digitalmars.com> ÓÏÏÂÝÉÌ/ÓÏÏÂÝÉÌÁ × ÎÏ×ÏÓÔÑÈ
ÓÌÅÄÕÀÝÅÅ: news:i24st1$12uh$1 at digitalmars.com...
> Jerome 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) { ... }
>
Hmm. Theoreticaly a bit more general
void func(T, U, V )(T rangeT, U rangeU, V rangeV) { ... }
void func(T:string, U, V )(T rangeT, U rangeU, V rangeV) { ... }
void func(T, U:string, V )(T rangeT, U rangeU, V rangeV) { ... }
void func(T, U, V:string )(T rangeT, U rangeU, V rangeV) { ... }
void func(T:string, U:string, V )(T rangeT, U rangeU, V rangeV) { ... }
void func(T:string, U, V:string )(T rangeT, U rangeU, V rangeV) { ... }
void func(T, U:string, V:string )(T rangeT, U rangeU, V rangeV) { ... }
void func(T:string, U:string, V:string )(T rangeT, U rangeU, V rangeV) {
... }
More information about the Digitalmars-d
mailing list