[C++-sig] Re: indexing_v2 status update

David Abrahams dave at boost-consulting.com
Sat Jan 24 15:16:19 CET 2004


Raoul Gough <RaoulGough at yahoo.co.uk> writes:

> "Niall Douglas" <s_sourceforge at nedprod.com> writes:
>
>> On 23 Jan 2004 at 10:49, Raoul Gough wrote:
>>
>>> 2. What is the likelihood that we would ever need more than 32 (there
>>>    are currently 16)?
>>> 
>>> What I'm thinking is, can we go with the simplest approach that works
>>> now, and switch to a more complex solution if it ever becomes
>>> necessary? Of course, it would be helpful to know what the above code
>>> would look like with a vector_c type solution.
>>
>> Surely you can use long long or __int64 as template parameters?
>
> I guess so - on compilers that support one or the other. long long is
> (still) not part of the C++ standard, AFAIK.
>
>>
>> Also, CUJ had an article about implementing infinite length numbers 
>> at compile time using templates. May be useful here.
>
> I haven't seen that issue - is it available online? Anyway I would
> guess that the same worry about complexity and notation applies. 

It requires a conforming compiler, and provides no more flexibility
than vector_c<...>

Steve Dewhurst was doing it by representing numbers as array types:

  char[two_to_the_0][two_to_the_32][two_to_the_64]...

It's cute, and probably takes fewer compile-time resources, but it's
probably not better.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com





More information about the Cplusplus-sig mailing list