Using lamdba for vector of array initialization
Hi.
I have vector of boost array:
typedef boost::array
On Thu, Jun 9, 2011 at 8:30 AM, Alexander Khomyak
Hi. I have vector of boost array:
typedef boost::array
array10; typedef std::vector<array10> vector_of_array10; vector_of_array10 v; v.resize(10); Now I initialize it using for statement:
for(vector_of_array10::iterator i = v.begin(); i != v.end(); ++i) (*i)[0] = '\0';
Using Boost.Phoenix (to be released with 1.47, already on trunk):
#include
How can I do the same initialization using lambda expression and for_each? In advance thank you very much for the tip.
HTH, Thomas
Thanks you, but I use Version 1.38.0 and can't change it so far.
-----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users- bounces@lists.boost.org] On Behalf Of Thomas Heller Sent: Thursday, June 09, 2011 11:16 AM To: boost-users@lists.boost.org Subject: Re: [Boost-users] Using lamdba for vector of array initialization
On Thu, Jun 9, 2011 at 8:30 AM, Alexander Khomyak
wrote: Hi. I have vector of boost array:
typedef boost::array
array10; typedef std::vector<array10> vector_of_array10; vector_of_array10 v; v.resize(10); Now I initialize it using for statement:
for(vector_of_array10::iterator i = v.begin(); i != v.end(); ++i) (*i)[0] = '\0';
Using Boost.Phoenix (to be released with 1.47, already on trunk): #include
using boost::phoenix::placeholders::_1; std::for_each(v.begin(), v.end(), _1[0] = '\0');
How can I do the same initialization using lambda expression and for_each? In advance thank you very much for the tip.
HTH, Thomas _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Thanks you, but I use Version 1.38.0 and can't change it for the time being.
-----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users- bounces@lists.boost.org] On Behalf Of Thomas Heller Sent: Thursday, June 09, 2011 11:16 AM To: boost-users@lists.boost.org Subject: Re: [Boost-users] Using lamdba for vector of array initialization
On Thu, Jun 9, 2011 at 8:30 AM, Alexander Khomyak
wrote: Hi. I have vector of boost array:
typedef boost::array
array10; typedef std::vector<array10> vector_of_array10; vector_of_array10 v; v.resize(10); Now I initialize it using for statement:
for(vector_of_array10::iterator i = v.begin(); i != v.end(); ++i) (*i)[0] = '\0';
Using Boost.Phoenix (to be released with 1.47, already on trunk): #include
using boost::phoenix::placeholders::_1; std::for_each(v.begin(), v.end(), _1[0] = '\0');
How can I do the same initialization using lambda expression and for_each? In advance thank you very much for the tip.
HTH, Thomas _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (2)
-
Alexander Khomyak
-
Thomas Heller