Boost logo

Boost :

From: Peder Holt (peder.holt_at_[hidden])
Date: 2004-08-31 06:29:15


On Tue, 31 Aug 2004 07:09:10 -0400, Arkadiy Vertleyb
<vertleyb_at_[hidden]> wrote:
> "Peder Holt" <peder.holt_at_[hidden]> wrote
>
> > I think i am closing in on the ultimate typeof implementation.
> >
> > Given the maximum depth of an expression = N (BOOST_MPL_LIMIT_VECTOR_SIZE)
> > and the depth of the expression we are evaluating = m
> > My earlier implementation was of the order (N^2)
> > Arkadiys implementation (if I am correct) is of the order (m*N)
>
> How do you estimate this? I believe my implementation has an order of N
> (BOOST_MPL_LIMIT_VECTOR_SIZE).
>
> > My new implementation is of the order (m) !!
>
> Without automatically creating classes at the typeof invocation?

To be precise, m*N/2

To deduce the type of an expression
int* a[10],
sizeof(foo<n>(a)), n=1..N
the compiler needs to generate the following types (names may vary)
encode_array<T[10],1>

encode_array<T[10],2>
encode_pointer<T*,1>

encode_array<T[10],3>
encode_pointer<T*,2>
encode_impl<int,1>

encode_array<T[10],4>
encode_pointer<T*,3>
encode_impl<int,2>
encode_dummy
...
-> N.

that is, N*m/2 types needs to be generated by the compiler. Please
correct me if I'm wrong.

My implementation generates the following types:
encode_array<T[10],1>
encode_pointer<T*,2>
encode_impl<int,3>
encode_dummy<4>
(plus dummy functions due to lack of partial template specialization)
m functions, m class types. m*2 template types
On a conforming compiler, m template types.

--
Peder Holt
> 
> 
> 
> Regards,
> Arkadiy
> 
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
>

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk