Boost logo

Boost :

Subject: Re: [boost] Phoenix: is there a Phoenix expression trait?
From: Thomas Heller (thom.heller_at_[hidden])
Date: 2011-05-15 03:30:19

On Sat, May 14, 2011 at 8:18 PM, Vicente BOTET <vicente.botet_at_[hidden]> wrote:
> Hi,
> I'm adding a convert_to Phoenix like functor to Boost.Conversion.
> I would like to use the same name, i.e. convert_to, but the overloads conflict. I would like to use sfinae to choose the correct overloading between
> template
> inline
> typename expression::convert_to, U>::type const
> convert_to(U const& u);
> template
> Target convert_to(Source const& from, boost::dummy::base_tag const& p=boost::dummy::base_tag())
> Is there a trait that can be used to detect if the parameter is a Phoenix expression?

There is boost::phoenix::is_actor<T>.

> BTW, I have just based my implementation on the one for static_cast, that uses the detail
> boost::phoenix::detail::target
> Could someone explain me why this is needed?

This is a dummy type just holding the type information to what the
expressions needs to be casted to. It's also used in construct and
It's use is that the target type gets "decoded" in the expression tree
without the target being default instantiated. (Some target types
don't have default construction).

> Could this detail be moved to the user interface?
It's really just a implementation detail ... I don't know.


Boost list run by bdawes at, gregod at, cpdaniel at, john at