Why D const is annoying

Timon Gehr timon.gehr at gmx.ch
Sat Dec 10 01:50:27 PST 2011


On 12/10/2011 10:43 AM, Mehrdad wrote:
> Moar coming... hey look, it's ANOTHER const-ness issue! :(
>
> import std.algorithm;
> struct Matrix
> {
> size_t[] _lengths;
> @property inout(size_t)[] lengths() inout { return _lengths; }
> @property size_t length() inout { return reduce!q{a*b}(lengths); }
> }
>
> // Error: template std.algorithm.reduce!("a*b").reduce(Args...) if
> (Args.length > 0 && Args.length <= 2 && isIterable!(Args[__dollar - 1]))
> does not match any function template declaration
> // Error: template std.algorithm.reduce!("a*b").reduce(Args...) if
> (Args.length > 0 && Args.length <= 2 && isIterable!(Args[__dollar - 1]))
> cannot deduce template function from argument types !()(inout(uint[2u]))

http://d.puremagic.com/issues/show_bug.cgi?id=6809


More information about the Digitalmars-d mailing list