Boost logo

Boost :

From: Jaakko Jarvi (jajarvi_at_[hidden])
Date: 2002-02-26 14:17:43


> How would typeof() solve this problem? You can deduce the return type, but
> we need a way to treat the entire wad of overloads for any given name as a
> single runtime entity to be resolved only at the point of invocation.

Having something like this:

struct foo {
  int operator()(int);
  double operator()(double);
};

typeof would solve the problem of finding out the return type after bind:
The result of, say,

bind(foo, _1)

is, greatly simplified:

class binder {

  F f; // foo will be stored here

public:

  template<class T>
  typeof(f(t)) // here typeof helps
  operator()(T t) { return f(t); }

};

But for the problem what was first discussed, having a way to express a
whole set of overloaded functions (including function templates),
typeof is of no help.

> Another important extension I hadn't thought of...
Yes.

Jaakko


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