|
Boost : |
From: William Kempf (sirwillard_at_[hidden])
Date: 2000-08-09 11:35:20
--- In boost_at_[hidden], Kevlin Henney <kevlin_at_c...> wrote:
> In message <20000809155851.15667.qmail_at_w...>, Dietmar
> Kuehl <dietmar_kuehl_at_y...> writes
> >If 'f()' is a function, I would consider this to be more natural:
> >
> > spawn_thread(f);
>
> Definitely, or something similar.
>
> >... and if 'f()' takes three arguments, I would still consider
> >
> > spawn_thread(f, 1, 2, 3);
>
> I would be inclined towards either recasting f as a function object
> type:
>
> spawn_thread(f(1, 2, 3));
>
> Or using a few adaptors, ie a little bit of currying.
Functor adapters are best used by functions that return the adapter.
For instance, we don't use std::binder1st<Pred>(x), we use
std::bind1st(Pred, x). Viewed in this light, their's little
difference if spawn_thread must take a specific functor type and we
use a function to adapt to this type, or if spawn_thread does the
adaption automatically. I'd lean towards seperating them only
because it means we have a *little* bit more in terms of reusability
of code.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk