Boost logo

Boost Users :

Subject: Re: [Boost-users] [Phoenix] for_each calling push_back for stl containers
From: Ryan (boost_at_[hidden])
Date: 2012-07-10 14:11:43


On Mon, Jul 9, 2012 at 4:14 PM, Joel de Guzman <joel_at_[hidden]>
 wrote:

>
> Yes, it's a scoping issue. Please read up:
>
> http://tinyurl.com/brufnnw

I apologize for not seeing this sooner. I got to the STL Algorithm page
through the Lazy Functions page in the Starter Kit. This in essence
skipped over some of the documentation and it didn't occur to me that I was
missing information.

Please read up before you bash the thing ;-)
>

I didn't mean to sound harsh. I gave a gut reaction about the needed
syntax to accomplish what I considered a simple task. I apologize if it
sounded like an attack on the library. That was not my intent. I really do
appreciate all the hard work that goes into these libraries.

> Actually, it could be simply:
>
> for_each(_1,
> lambda
> [
> push_back(ref(string_tokens), _1)
> ]
>
> )
>

Thank you for simplifying it even further. I tried it and it compiles and
works. I did tried and reduce it even further.

for_each( ref(tokens),
  lambda
  [
    push_back(ref(string_tokens), _1)
  ]
)

This compiled but didn't work as intended. Why is push_back able take a
reference to string_tokens but for_each isn't able to take a reference to
tokens?

Ryan



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