|
Boost : |
From: Craig Henderson (cdm.henderson_at_[hidden])
Date: 2002-09-09 02:30:37
Thanks David. I guess if I'm gonna ask stupid questions like this, it should
go to the boost.user list :-)
"David Abrahams" <dave_at_[hidden]> wrote in message
news:012d01c2575d$cdf27830$6401a8c0_at_boostconsulting.com...
> From: "Craig Henderson" <cdm.henderson_at_[hidden]>
>
>
> > I have a problem with the BOOST_STATIC_ASSERT macros on VC++.Net. My
> class
>
> ...
>
> > Please could someone explain this behaviour? Am I missing something or
> there
> > something wrong with the macro or vc++ compatibility?
>
> Expressions passed to BOOST_STATIC_ASSERT can only be compile-time
> expressions (thus the word STATIC in the name), but typeid() is a runtime
> expression. If you want a runtime assert, use <cassert>. If you want to
> assert that types are the same at compile-time, try:
>
> #include <boost/type_traits.hpp>
>
> ...
>
> BOOST_STATIC_ASSERT((
> boost::is_same<typename Res::value_type,
diff_result<T>*>::value));
>
> or if you want equivalent behavior to your typeid() expression:
>
> BOOST_STATIC_ASSERT((
> boost::is_same<
> typename boost::remove_cv<
> typename boost::remove_reference<
> typename Res::value_type
> >::type
> >::type
> , diff_result<T>*
> >::value
> ));
>
>
> HTH,
> Dave
> -----------------------------------------------------------
> David Abrahams * Boost Consulting
> dave_at_[hidden] * http://www.boost-consulting.com
>
> _______________________________________________
> 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