Boost logo

Boost :

From: Vesa Karvonen (vesa.karvonen_at_[hidden])
Date: 2001-07-21 21:46:02


From: "Aleksey Gurtovoy" <alexy_at_[hidden]>
> Ronald Garcia wrote:
> > This sounds great to me. I am very curious to see what work you have
> > done. I'm not familiar with the languages you have mentioned, but I
> > understand that the STL was designed based upon previous work done in
> > scheme. Carrying these ideas over to template metaprogramming is very
> > fitting.
>
> That's what 'boost::mpl' library does :), see
> http://groups.yahoo.com/group/boost/files/mpl/. As far as I understand, Vesa
> is advocating pure functional approach to implementing metaprogramming
> algorithms/collections/utility functions framework - no state, no iterators,
> recursion instead of iteration, etc. In some sense, it fits the C++
> metaprogramming model better than "traditional" generic programming (STL)
> style.

Yes. C++ templates form a pure functional language, and I believe there is lot
to be learned from modern functional programming languages and their standard
libraries.

> I believe that both models have their place, and that we can benefit
> from each other work.

There is definitely benefit to be had from each other work. Of course, there
is no right or wrong model, some models are just more useful than others
(while solving particular kinds of problems).

> > your foldr sounds a lot like std::accumulate in the STL world, but
> > applied to template metaprograms.
>
> 'accumulate' in 'boost::mpl' looks like, well, accumulate:
>
> mpl::accumulate< value_list<0, 1, 2, 3>, int_value<0> >::value
>
> or, with explicit 'add' metafunction,
>
> mpl::accumulate< value_list<0, 1, 2, 3>, int_value<0>, add >::value

Nice! It seems that the copy of MPL that I have is dated...


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk