Boost logo

Boost :

From: Arkadiy Vertleyb (vertleyb_at_[hidden])
Date: 2005-05-28 06:42:05


"Peder Holt" <peder.holt_at_[hidden]> wrote

> I did some tests on VC8 beta, and it compiles the testcase in half the
> time compared to the present implementation of typeof_impl. As far as
> I have been able to test, it also works around the compiler bug for
> VC8 discussed earlier.
>
> Here is a more detailed sketch of the proposed solution:
>
> namespace boost {namespace type_of{
> template<typename T>
> struct encode_result {
> typedef typename encode_type<BOOST_TYPEOF_VECTOR(0)<>,
> T>::type encoded_type;
> typedef typename mpl::size<encoded_type>::type size;
> char (&value0)[...];
> char (&value1)[...];
> char (&value2)[...];
> ...
> char (&value50)[...];
> };
>
> template<class T>
> encode_result<T> typeof_result(const T&);
> }}
> #define BOOST_TYPEOF_AT(n, expr)
> sizeof(boost::type_of::typeof_result(expr).BOOST_PP_CAT(value,n))

Interesting... Let me guess:

char(&value2)[mpl::at<encode<T>::type, mpl::int<(2 < size) ? 2 : 0>
>::type::value]; //?

Regards,
Arkadiy


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