Boost logo

Boost :

From: Aleksey Gurtovoy (agurtovoy_at_[hidden])
Date: 2002-04-11 17:19:03


Douglas Gregor wrote:
> > FWIW I like your original named parameters approach better.
> >
> > boost::signal<int, int, int>::combiner_is< maximum<int> >::type sig_max;
>
> My only complaint against the original named parameters approach is that
it
> gets really obnoxious when one of the types is a template type. I really,
> really hate:
>
> typename boost::signal<T, T, T>::template combiner_is< maximum<T>
>::type
>
> I'm not even sure where the 'typename' belongs in that mess...

Well, IMO the "wrapping named parameters" approach is not better in terms of
verboseness, if you spell it as one will have to spell it in the real world:

    boost::signal<int, int, int,
        boost::signals::combiner_is<
            boost::signals::maximum<int>
>
> sig_max;

or, with using declarations,

    using boost::signals::combiner_is;
    using boost::signals::maximum;
    boost::signal<int, int, int, combiner_is< maximum<int> > > sig_max;

And you have to do it every time, while with original named parameters
approach verboseness only shows in (IMO relatively rare) cases of
'function<..>' type being declared inside of a template.

BTW, one way to deal with the unclearness that

  boost::signal<int, int, int>::combiner<maximum<int> >::type sig_max;

declares a signal, not a combiner, is to implement something like this:

  boost::signal<int, int, int, boost::signal_traits
    ::combiner< boost::signals::maximum<int> > // or even
boost::signals::maximum<_1> :)
> sig_max;

Aleksey


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk