Boost logo

Boost Users :

Subject: Re: [Boost-users] [typeof] Determining if a type has been registered or not at compile time
From: joel falcou (joel.falcou_at_[hidden])
Date: 2009-12-22 13:03:48


Edward Diener wrote:
> 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*/>
> >
A simple way could be to add a meta-function specialisation in the
typeof registration macro so that a is_registered<T> is available in a
pervasive way.

-- 
___________________________________________
Joel Falcou - Assistant Professor
PARALL Team - LRI - Universite Paris Sud XI
Tel : (+33)1 69 15 66 35

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net