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) { ... }

Reply via email to