Boost logo

Proto :

Subject: Re: [proto] vector of proto expressions
From: Nate Knight (Nate.Knight_at_[hidden])
Date: 2011-03-18 10:59:07


>
> In pseudo code it should look like this:
>
> Expressions< N > expressions;
> construct( expressions ); // or something similar
> do_step( epxressions , x ); // my method

How about something like?

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

#include <boost/proto/proto.hpp>

using namespace boost::proto;

template<class Expr, class X>
void my_method(Expr const& e, X const& x)
{
}

int main()
{
    using namespace boost::proto;

    terminal<int>::type i = {0};
    my_method( (i+i, i*i, i*i*i), 10);
}

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Notice that you don't need to explicitly store the expressions in a container, you can just combine them in a larger expression tree which can be parsed in my_method.

Nate

This message and any attachments are intended only for the individual or entity to which the message is addressed. This is a private message and may contain privileged information. If you are neither the intended recipient nor the agent responsible for delivering the message to the intended recipient, you are hereby notified that any review, retransmission, dissemination, or taking of any action in reliance upon, the information in this communication is strictly prohibited, and may be unlawful. If you feel you have received this communication in error, please notify me immediately by returning this email to me and deleting it from your computer.


Proto list run by eric at boostpro.com