Boost logo

Boost :

From: Douglas Gregor (gregod_at_[hidden])
Date: 2002-07-19 10:31:07


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 not
> 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 2-5

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 the
'one true interface' that we'd like to use, should we make a clean break?
Maybe version the old boost::function code (e.g., stick it in
boost::deprecated and supply an import library), and provide a completely new
version based on this syntax?

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

        Doug


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