Boost logo

Boost Users :

Subject: [Boost-users] [phoenix] v2 to v3 transition of extension mechanism
From: alfC (alfredo.correa_at_[hidden])
Date: 2011-04-12 01:59:13

Hi, I am updating some of my code to use Phoenix3 instead of

For example in Phoenix2 I used to have this extension to support
'cos(...)' expressions:

namespace boost{
namespace phoenix{
        struct cos_eval{
                template<class Env, typename Arg_> struct result{typedef double
                template<class RT, typename Env, typename Arg_> static RT eval(Env
const& env, Arg_ const& arg_){
                        return cos(arg_.eval(env));
        template<typename Arg_>
        void cos(Arg_ const& arg_){
                return compose<cos_eval>(arg_);

In Phoenix3, if I followed things correctly (from here
the new framework ask for the following, which doesn't work. The error
(see at end) is difficult to decipher. What am I missing to implement
this simple expression extension? -- Thanks.

#include<boost/phoenix/phoenix.hpp> //v3
  , (meta_grammar) // Arg

namespace boost { namespace phoenix
        struct cos_eval{
                typedef double result_type;

                template <typename Context, typename Arg>
                operator()(Context const& ctx, Arg const& arg) const{
                    return std::cos(eval(arg, ctx));

        template <typename Dummy>
        struct default_actions::when<rule::cos_, Dummy>
                : call<cos_eval, Dummy>

        template <typename Arg>
        typename expression::cos_<Arg>::type const
        cos_(Arg const& arg){
                return expression::cos_<Arg>::make(arg);

usr/include/boost/proto/matches.hpp:846:13: error: no type named
‘proto_tag’ in ‘const struct
boost::proto::argsns_::term<boost::phoenix::argument<1> >, 0l> > >,
1l> >*, double&>&, const boost::phoenix::default_actions&>’
compilation terminated due to -Wfatal-errors.

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at