[proto]: Adding functions to the lazy vector example

Hi I am experimenting with the lazy vector example. I want to add the functions to the example but not in the LazyVector class. Like for example I want to add a function INC which increments each element of the vector and returns a vector. How can I add this to the example? Thanks in anticipation Regards

On 11/2/2010 11:56 AM, Noman wrote:
I am experimenting with the lazy vector example. I want to add the functions to the example but not in the LazyVector class. Like for example I want to add a function INC which increments each element of the vector and returns a vector. How can I add this to the example?
Do you mean you want INC to *only* work on vector terminals, or should it work also on complex expressions? Should it evaluate eagerly or lazily? -- Eric Niebler BoostPro Computing http://www.boostpro.com

Eric Niebler
Do you mean you want INC to *only* work on vector terminals, or should it work also on complex expressions? Should it evaluate eagerly or lazily?
I want to move from the simple(only vector) to the complex version. It should evaluate lazily.

Waiting for your response Eric. Thanks again

On 11/4/2010 4:48 AM, Noman wrote:
Waiting for your response Eric. Thanks again
How is your INC function any different than pre-increment? If it's no different, you could just do this: proto::make_exprproto::tag::pre_inc const INC = {}; -- Eric Niebler BoostPro Computing http://www.boostpro.com

How is your INC function any different than pre-increment? If it's no different, you could just do this:
proto::make_exprproto::tag::pre_inc const INC = {};
Its the same. But I want to know the mechanism to add any new function working on the vectors. That can be INC or can be anything else. The question is how can I add any function without adding something to the class vector.

On 11/4/2010 9:43 AM, Noman wrote:
How is your INC function any different than pre-increment? If it's no different, you could just do this:
proto::make_exprproto::tag::pre_inc const INC = {};
Its the same. But I want to know the mechanism to add any new function working on the vectors. That can be INC or can be anything else. The question is how can I add any function without adding something to the class vector.
This is all described in the docs: http://www.boost.org/doc/libs/1_44_0/doc/html/proto/users_guide.html#boost_p... -- Eric Niebler BoostPro Computing http://www.boostpro.com
participants (2)
-
Eric Niebler
-
Noman