Checking function parameters in Phobos

Timon Gehr timon.gehr at gmx.ch
Wed Nov 20 06:14:28 PST 2013


On 11/20/2013 02:52 PM, Jacob Carlborg wrote:
> On 2013-11-20 13:56, Timon Gehr wrote:
>
>> We do in any case:
>>
>> import std.algorithm, std.range;
>>
>> void main(){
>>      auto a = [1,2,3,4,5];
>>      auto s = sort(a);
>>      swap(a[0],a[$-1]);
>>      assert(is(typeof(s)==SortedRange!(int[])) && !s.isSorted());
>> }
>>
>
> I don't understand what this is supposed to show. That the type is
> "SortedRange" but it's actually not sorted?
>

Yes, hence SortedRange being sorted is just a convention in any case.


More information about the Digitalmars-d mailing list