|
Boost Users : |
Subject: Re: [Boost-users] Boost Phoenix Arguments Passing & Storage (-- Proper Type?) & Application to RValues -- Possible?
From: Matt (matdzb_at_[hidden])
Date: 2012-02-15 12:33:55
On 2/15/2012 03:57, Mathias Gaunard wrote:
> You're using Phoenix v2, which doesn't support rvalues and also has
> many type deduction problems. Try v3.
Thanks!
Upgrading to Version 1.49.0 beta 1 fixed the Application-to-RValues part.
Now, to the proper-type-name for passing & storage part.
I've tried the following and it works:
auto newActor() -> decltype((arg1 % 2 == 1))
{
return (arg1 % n == 0);
}
auto f = (arg1 % 2 == 1);
auto g = f;
g = newActor();
I can find out the type name using non-portable typeid(Variable).name(),
but the output is somewhat inconvenient (quoted below).
Is there a nice-to-type solution?
It'd be esp. useful for non-C++11 compiler, where I cannot use
trailing-return-type for "newActor" function nor type deduction for "f"
and "g" variables -- what's the suggested type in this situation?
I've realized that using boost::function (or std::function) won't work
either, since it's monomorphic (while one of the reasons I'm looking at
Boost.Phoenix is polymorphic lambdas).
Type name:
struct boost::phoenix::actor
<
struct boost::proto::exprns_::basic_expr
<
struct boost::proto::tagns_::tag::equal_to,
struct boost::proto::argsns_::list2
<
struct boost::phoenix::actor
<
struct boost::proto::exprns_::basic_expr
<
struct boost::proto::tagns_::tag::modulus,
struct boost::proto::argsns_::list2
<
struct boost::phoenix::actor
<
struct boost::proto::exprns_::basic_expr
<
struct boost::proto::tagns_::tag::terminal,
struct boost::proto::argsns_::term
<
struct boost::phoenix::argument<1>
>,
0
>
>,
struct boost::phoenix::actor
<
struct boost::proto::exprns_::basic_expr
<
struct boost::proto::tagns_::tag::terminal,
struct boost::proto::argsns_::term<int>, 0
>
>
>,
2
>
>,
struct boost::phoenix::actor
<
struct boost::proto::exprns_::basic_expr
<
struct boost::proto::tagns_::tag::terminal,
struct boost::proto::argsns_::term<int>, 0
>
>
>,
2
>
>
Best,
Matt
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