$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: Douglas Paul Gregor (gregod_at_[hidden])
Date: 2003-01-23 09:48:49
On Wed, 22 Jan 2003, David Abrahams wrote:
> I've been talking with Aleksey recently about how to improve the
> syntactic situation without losing the separation of concerns that we
> get, but we didn't come up with anything convincingly better. I think
> a long time ago the for_each parameter used to look like:
>
> class f
> {
> template <class T>
> struct apply
> {
> static void execute() {...};
> };
> };
>
> IOW, a metafunction class with a nested 'execute' function. However
> that's not really any better syntactically, it has problems carrying
> state, and it's anti-idiomatic.
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?
Doug