Boost logo

Boost :

From: Aleksey Gurtovoy (alexy_at_[hidden])
Date: 2002-03-13 12:54:10


David Abrahams wrote:
> > metafunctions, and that doesn't help the compiler. Without
> > seeing the code and errors I can't say if that's the case, but
> > there is a chance that using something named less
> > provocative as a wrapper template can help here.
>
> Tried that, too :^(
>
> struct X;
> template <class T> struct wraps{};
> template <class T> char f(wraps<T&>);
> int main()
> {
> sizeof(f(wraps<X&>()));
> return 0;
> };

This compiles:

#include "boost/static_assert.hpp"

struct X;
template <class T> struct wraps{};
template <class T> char f(wraps<T&>);
template <class T> char(& f(void const volatile*))[2];

int main()
{
    BOOST_STATIC_ASSERT(sizeof(f<X>(wraps<X&>())) == 1);
    return 0;
}


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