|
Boost : |
Subject: Re: [boost] Phoenix: is there a Phoenix expression trait?
From: Vicente Botet (vicente.botet_at_[hidden])
Date: 2011-05-15 04:28:44
Thomas Heller-7 wrote:
>
> 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>.
>
I will try it.
>> 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
> new_.
> 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).
>
Oh, I see. Thanks for the explanation.
>> Could this detail be moved to the user interface?
> It's really just a implementation detail ... I don't know.
>
Doesn't matter. It seems it plays the same role that the template classes
dummy::base_tag/type_tag I included in Boost.Conversion to transport the
Target type. I will use my dummy classes instead.
Thanks,
Vicente
-- View this message in context: http://boost.2283326.n4.nabble.com/Phoenix-is-there-a-Phoenix-expression-trait-tp3522893p3524024.html Sent from the Boost - Dev mailing list archive at Nabble.com.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk