Boost logo

Boost :

Subject: [boost] [typeof] Determining if a type has been registered or not at compile time
From: Edward Diener (eldiener_at_[hidden])
Date: 2009-12-22 09:47:49


Is there any way one can determine whether a type has been registered or
not with Boost.Typeof at compile time so that the information can be
used in TMP ? I am thinking, of course, of the use of typeof in a
template, where a template parameter may or may not be aregistered type
when the template has been instantiated. I would like to provide my own
TMP fallback code if the type has not been registered rather than see
an immediate compiler error generated. Something like:

boost::mpl::eval_if
   <
   boost::typeof::registered<T>, // this would be nice to have
   boost::mpl::identity<BOOST_TYPEOF_TPL(some_expression)>,
   boost::mpl::identity</* use another facility to get the type I want
into a metafunction*/>
>


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