From: Larry Evans (cppljevans_at_[hidden])
Date: 2005-03-05 15:17:27
Is there any interest in a proposed mpl sequence, fold_seq,
derived from mpl::fold and contained in
cppljevans/mpl/fold_seq_test.zip? This zip contains:
* a test driver, fold_seq_test.cpp
* a header file, fold_seq.hpp
* bjam output of driver for intel
* bjam output of driver for gcc.
A better name for fold_seq might be cummulative_app since
each element is a "partial_application" of the ForwardOp
"operation" to part of the Seqence, where ForwardOp and
Seqence are the arguments to fold, as described here:
The reason for term "partial_application" is that it
corresponds to "partial sum" described here:
Alternative names include "prefix reduction" or "scan":
Anyway, it seems that it's a useful extension to fold,
since, as seen by the above references, the corresponding
math concept occurs often.
In addition, the test driver in the vault contains
test_partial_product, where the value's at each element of
the fold_seq correspond to elements in a cummulative
Such a cummulative product could be used to calculate, at
compile time, the strides for an instance of mult_array.
Also, fold_seq could be used as a replacement for the
get_side_type template class mentioned here:
and used to access the elements in a tuple, as demonstrated
by the test_tuple_access function in the test driver.
I'd be glad to discuss improvements or reasons why it's
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk