Why D const is annoying

Mehrdad wfunction at hotmail.com
Sat Dec 10 01:43:41 PST 2011


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]))


More information about the Digitalmars-d mailing list