Templates, implicit conversions and const
Regan Heath
regan at netmail.co.nz
Tue Jul 10 01:07:37 PDT 2007
Kirk McDonald wrote:
> Re-write the function as:
>
> bool contains(T, U)(T[] array, U value) {
> foreach(v; array) if (v == value) return true;
> return false;
> }
>
> You can still compare a const(char) and a char for equality.
Good point, why didn't I think of that.
Regardless I think it would be nice if templates applied implicit
conversions to find matches.
Regan
More information about the Digitalmars-d
mailing list