|
Boost Users : |
From: Hendrik Belitz (hbelitz_at_[hidden])
Date: 2007-03-29 05:09:40
Dear fellow boost users,
I'd like to address a problem I just encountered on using mpl::for_each
(Boost 1.33). Similar to Scott, I implemented a stateful functor that should
be called for all types in a mpl::vector<>. for_each is no option, since it
passes the functor by value (Maybe someone could enlighten me in stating why
this is a wanted behaviour? According to the meta-programming book, for_each
takes a functor to be able to store the results of a computation which is
not possible if the functor is copied?). Are there any alternatives to
for_each for that case?
Regards
Hendrik
-----Ursprüngliche Nachricht-----
Von: boost-users-bounces_at_[hidden]
[mailto:boost-users-bounces_at_[hidden]] Im Auftrag von Aleksey Gurtovoy
Gesendet: Donnerstag, 29. März 2007 11:48
An: boost-users_at_[hidden]
Cc: dave_at_[hidden]; Scott Meyers
Betreff: Re: [Boost-users] [mpl] Doc for for_each
Scott,
Scott Meyers writes:
> Having written code using a stateful functor with mpl::for_each and
> observing that side effects were not taking place, I went to
> http://www.boost.org/libs/mpl/doc/refmanual/refmanual_toc.html to
> confirm my suspicion that the functor was being passed by value. But
> there appears to be no documentation for mpl::for_each (neither in the
> HTML version of the reference manual nor in the PDF version). I
> ultimately confirmed my suspicion by looking at the header file, but
> is there a reason why for_each seems to be documented only in the
> printed book?
It was (accidentally) missed out. It's fixed in 1.34 release; meanwhile, the
page can be accessed online at http://tinyurl.com/2f3zvv
(http://boost.cvs.sourceforge.net/*checkout*/boost/boost/libs/mpl/doc/refman
ual/for-each.html?revision=1.1.2.1&pathrev=RC_1_34_0)
HTH,
-- Aleksey Gurtovoy MetaCommunications Engineering _______________________________________________ Boost-users mailing list Boost-users_at_[hidden] http://lists.boost.org/mailman/listinfo.cgi/boost-users
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