total noob help: LAMBDA with zip_iterator
I have several questions that I asked earlier but never got an answer. So I will start one by one.. a.) How do I use lambda with zip_iterator. (assuming you have a zip_iterator of vector, list, map)? Thats my first question...
"chun ping wang"
I have several questions that I asked earlier but never got an answer.
So I will start one by one..
a.) How do I use lambda with zip_iterator. (assuming you have a zip_iterator of vector, list, map)?
Thats my first question...
There are many possible answers. What are you trying to accomplish with lambda and zip_iterator? -- Dave Abrahams Boost Consulting www.boost-consulting.com
alright i am trying to stimulate the safety algorithm Operating system
concepts seventh edition book. Note i haven't use static_assert yet.
Basically i am trying to experiment on how boost can help replace low level
concept code in which any language be it, php, perl, java (i.e. replace of
indexing if possible) can write simple algorithm whether to increase
readability, maintainbility or anything. All these are just experimental
code. Thank you very much.The problem with python iterators is that you
can't reassign iteration values in list.
template
bool DLA::isSafe(const typename DimArray
"chun ping wang"
writes: I have several questions that I asked earlier but never got an answer.
So I will start one by one..
a.) How do I use lambda with zip_iterator. (assuming you have a zip_iterator of vector, list, map)?
Thats my first question...
There are many possible answers. What are you trying to accomplish with lambda and zip_iterator?
-- Dave Abrahams Boost Consulting www.boost-consulting.com
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
"chun ping wang"
std::for_each( // iterate through (Need, Alloc, Finish). boost::make_zip_iterator(boost::make_tuple(beg1, beg2, beg3)), boost::make_zip_iterator(boost::make_tuple(end1, end2, end3)), ( Parts where i wish to use lambda for abstraction . Assume: _1 = Need[i], _2 = Alloc[i], _3 = Finish[i], if (_1 == false && _3 <= Work) { _3 = true; Work += _2; } ++var(ind) ) );
Ah. What you want is a way to wrap a lambda expression so that it accepts a single tuple argument and exposes each element of the tuple to the wrapped lambda expression as a separate argument. It should be possible, but we'll have to ask Jaakko and Gary for details. I'm pretty sure it's possible using Fusion and Spirit-2, but you'd need a different version of zip_iterator.hpp (one that's checked in on a branch of Boost's CVS). -- Dave Abrahams Boost Consulting www.boost-consulting.com
participants (2)
-
chun ping wang
-
David Abrahams