
hi, template <typename CT> class C { BOOST_STATIC_ASSERT(...); }; class D; I would like to forbid the instantiation of C<D>. How can i compare CT with D to serve as the condition of the boost static assert=? rds,

Hicham Mouline wrote:
hi,
template <typename CT> class C { BOOST_STATIC_ASSERT(...); };
class D;
I would like to forbid the instantiation of C<D>.
How can i compare CT with D to serve as the condition of the boost static assert=?
See http://www.boost.org/doc/html/boost_typetraits/reference.html#boost_typetrai... You may also need to use other type_traits to remove CV and reference/pointer qualifiers. Jeff Flinn

Either use boost::is_same as Jeff Flinn suggested. Something like this:
//-----------
template <typename CT> class C {
BOOST_STATIC_ASSERT(( ! boost::is_same
-----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Jeff Flinn Sent: Wednesday, November 28, 2007 2:53 PM To: boost-users@lists.boost.org Subject: Re: [Boost-users] BOOST_STATIC_ASSERT
hi,
template <typename CT> class C { BOOST_STATIC_ASSERT(...); };
class D;
I would like to forbid the instantiation of C<D>.
How can i compare CT with D to serve as the condition of
Hicham Mouline wrote: the boost static assert=?
See
http://www.boost.org/doc/html/boost_typetraits/reference.html#boost_typetrai ts.is_same
You may also need to use other type_traits to remove CV and reference/pointer qualifiers.
Jeff Flinn
participants (3)
-
Hicham Mouline
-
Jeff Flinn
-
v2cechura