Ranges longer than size_t.max

Peter Alexander peter.alexander.au at gmail.com
Sat Dec 29 01:00:44 PST 2012


On Saturday, 29 December 2012 at 03:28:47 UTC, Andrei 
Alexandrescu wrote:
> On 12/28/12 9:21 PM, Peter Alexander wrote:
>> I'm already assuming 64-bit. What I'm saying is that 64-bit 
>> sometimes
>> isn't even enough (for example in the case of a permutations 
>> range). I'm
>> asking if allowing length to return BigInt would be reasonable.
>
> I think it would complicate a lot of things for the benefit of 
> a few cases.

I agree, but the range of permutations will be longer than 2^64 
on occasion, so what do we do?

* Don't provide .length at all
* Provide it as size_t, and assert on overflow
* Provide it as size_t, and silently overflow


More information about the Digitalmars-d mailing list