|
Boost : |
From: David Abrahams (dave_at_[hidden])
Date: 2003-01-23 08:19:30
"Peter Dimov" <pdimov_at_[hidden]> writes:
> From: "David Abrahams" <dave_at_[hidden]>
>>
>> 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.
>
> The state problem is easy:
>
> struct F
> {
> template<class T> void execute();
> };
Which isn't usable portably on all broken platforms, nor is it that
different from:
struct F
{
template <class T> void operator()(T) { ... };
};
it's-a-bag-'o'-tradeoffs-ly y'rs,
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