IFTI with D2?
Frank Benoit
keinfarbton at googlemail.com
Wed Nov 7 06:11:32 PST 2007
Steven Schveighoffer schrieb:
> In addition, The real requirement is that Frank wants to templatize the
> array element type, but not its constness. For example, if the template
> pattern was:
>
> uint searchPattern(T)(const(T)[] arg1, const(T) arg2){...}
>
> This still wouldn't compile for line 3, even though it would be perfectly
> legal to cast both arguments to const. The challenge is to express
> something that says the function will not alter the arguments, but you also
> want to template the argument type.
>
> -Steve
>
>
Yes exactly.
And additionally it should be possible to create functions with specific
arguments be const or mutable with same type.
T[] replace(T)( const(T)[] str, const(T)[] pattern, const(T)[] repl, T[]
output = null ){ .... }
In this case the last arg must be mutable.
More information about the Digitalmars-d
mailing list