C++ guys hate static_if?

monarch_dodra monarchdodra at gmail.com
Thu Mar 14 16:18:14 PDT 2013


On Thursday, 14 March 2013 at 20:57:57 UTC, Timon Gehr wrote:
> On 03/14/2013 06:51 PM, Andrei Alexandrescu wrote:
>> On 3/14/13 1:48 PM, H. S. Teoh wrote:
>>> I don't agree. Phobos is a prime example. Does Phobos have 
>>> unittests?
>>> Yes, and lots of them. Does it still have non-compilable 
>>> template
>>> instantiations? Yes, because unittests can't cover all 
>>> possibilities --
>>> there are too many possible combinations of template 
>>> arguments. There
>>> are bound to be untested combinations which don't work but 
>>> we're unaware
>>> of.
>>
>> If you found a few, that would be great. I don't think you'll 
>> have an
>> easy time.
>>
>> Andrei
>>
>
> Challenge accepted. Clearly the Phobos developers do not 
> instantiate their templates before shipping them. :o)
>
> The following breaks most of std.range, and most of 
> std.algorithm could likely be broken too, but I am too lazy to 
> investigate.

All this breakage is just one and the same bug. These ranges, for 
some reason, are testing Unqual!Range, and then attempt to store 
an Unqual!Range, which makes no sense, since the passed type is 
not Unqual!Range, it's Range.

Probably an old C++ habit, where you can cast away constness by 
copy. This is not the case in D.

In any case, all of std.range (and some of algorithm) need to be 
stripped of this.


More information about the Digitalmars-d mailing list