Boost logo

Boost :

From: David Abrahams (david.abrahams_at_[hidden])
Date: 2002-07-19 10:44:01

From: "Douglas Gregor" <gregod_at_[hidden]>
> On Friday 19 July 2002 10:49 am, David Abrahams wrote:
> > Oh, I buy that argument!
> >
> > I like the idea of using the reference-to-function. However, is that
> > also a legal function return type?
> >
> > -Dave
> It is. However, just naming a function type would still work:
> function<void (char const * name, int mode)> pf;
> I really like this interface. Just to try to summarize the benefits an
> interface like this would have:
> 1) Ability to use parameter names without /* */
> 2) Only a single parameter to encode the argument & return types we are
> dealing with (much better for error messages, link compatibility, etc.)
> 3) Can't forget which type is the return type
> 4) No need for function0, function1, etc. classes
> 5) No need for named template parameters
> 6) No need to learn or import any typelist facilities to get benefits

7) A benefit for generic functions which accept function pointers and
produce function objects:

    template <class F> function<F> wrap(F* p);

> It would be possible to introduce this interface into the current
> Boost.Function, but I wonder: if we all were to agree that this would be
> 'one true interface' that we'd like to use, should we make a clean break?

I'm inclined to say yes.

> Maybe version the old boost::function code (e.g., stick it in
> boost::deprecated and supply an import library), and provide a completely
> version based on this syntax?

If we could find a way to provide a warning for uses of the deprecated
syntax as a transition plan, that would be ideal.

> Might need to figure out how to get this working on MSVC first :(


You've been around longer than that, haven't you?


Boost list run by bdawes at, gregod at, cpdaniel at, john at