Boost logo

Boost :

From: Yitzhak Sapir (yitzhaks_at_[hidden])
Date: 2002-10-23 10:42:16


On Wed, 23 Oct 2002, Peter Dimov wrote:

> From: "Aleksey Gurtovoy" <agurtovoy_at_[hidden]>
> > Peter Dimov wrote:
> > > is_incomplete can never work. It violates ODR. ;-)
> >
> > You are right, of course. It should be something like this instead:
>
> [...]
>
> > Hmm, actually we can do even better:
> >
> > #define BOOST_IS_INCOMPLETE(T) \
> > is_incomplete< T, boost::mpl::integral_c<long,__LINE__> > \
> > /**/
> >
> > template< typename T >
> > struct something
> > : mpl::if_c<
> > BOOST_IS_INCOMPLETE(T)::value
> > , something_impl1<T>
> > , something_impl2<T>
> > >
> > {
> > };
>
> Now something<> violates ODR. ;-)

It could be used as BOOST_STATIC_ASSERT_COMPLETE(T). This might catch
compile-time errors earlier on, rather than in the midst of the library
where many times the user has no idea what is going on and what he might
have done wrong.


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