|
Boost : |
From: David Abrahams (dave_at_[hidden])
Date: 2003-01-23 09:59:07
Douglas Paul Gregor <gregod_at_[hidden]> writes:
> Why don't we have
>
> mpl::list<int, float, double, std::string> list_of_types;
> for_each(list_of_types.begin(), list_of_types.end(), f);
>
> ?
>
> Then an unqualified for_each call can handle type sequences, heterogeneous
> containers (e.g., tuple), and run-time sequences (e.g., vector). It's been
> done before, elsewhere, so why don't we do it in MPL?
It's clever, but I'm not sure what problem it's solving. AFAICT it
doesn't solve the problem that Andrei was pointing at. It also has at
least one problem: it is intrusive on sequence types, requiring them
to have begin()/end() member functions. If this was the only way to
do it, it would break interoperability with 3rd-party type sequences.
-Dave
-- David Abrahams dave_at_[hidden] * http://www.boost-consulting.com Boost support, enhancements, training, and commercial distribution
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk