Boost logo

Boost :

From: Peder Holt (peder.holt_at_[hidden])
Date: 2005-05-28 07:20:16


On 5/28/05, Arkadiy Vertleyb <vertleyb_at_[hidden]> wrote:
> "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]; //?

Yep :)

        char(&value2)[mpl::at<encoded_type,mpl::int_<(2 < size::value)
? 2 : 0>
>::type::value];

Peder

>
> 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