Boost logo

Boost :

From: Aleksey Gurtovoy (alexy_at_[hidden])
Date: 2002-03-13 17:52:16


David Abrahams wrote:
> > BOOST_STATIC_ASSERT(sizeof(f<X>(wraps<X&>())) == 1);
> oops, missed this-------------^^^
>
> It wasn't an SP5 thing, it was the above.
> However, how can we apply that? To even write that, you not
> only need to know that X is a reference, you need to know
> what it refers to!

You are right, it doesn't help.

Returning to your original question, I as well would be in favor of version
that works with abstract classes, but the implementation you cited doesn't
seem to satisfy this requirement either:

> template <class T>
> yes_type BOOST_TT_DECL is_pointer_helper(T*(*)());
> no_type BOOST_TT_DECL is_pointer_helper(...);
> template <typename T>
> struct is_pointer
> {
> public:
> BOOST_STATIC_CONSTANT(bool, value =
> (::boost::type_traits::ice_or<
> (1 ==
> sizeof(detail::is_pointer_helper((T(*)())0))),
                                   ^^^^^^^^

> (1 == sizeof(detail::is_function_tester(t)))
> >::value)
> >::value ) );
> };

If T is an abstract type, declaring a pointer to function that returns T is
still illegal. Or am I missing something?

Aleksey


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