Boost logo

Boost :

From: Douglas Gregor (gregod_at_[hidden])
Date: 2002-07-19 14:54:36

On Friday 19 July 2002 03:16 pm, Giovanni Bajo wrote:
> > I've implemented this capability in Boost.Function; it's in CVS now. The
> class
> > template boost::function now effectively has a dual signature:
> I might be wrong, but your implementation just seems to check if the first
> template parameter is a pointer-to-function type. Doesn't this break old
> code that define a function<> returning a function pointer?
> void (*)(int) MyFunc(void)
> { ... }
> function<void (*)(int)> a = MyFunc; // now it's broken!
> Giovanni Bajo

It checks for a function type, not a pointer-to-function type. According to
the is_function docs:

  "Evaluates to true only if T is a function type (note not a reference or
   pointer to function)."

I had to add the pointer back for the 'function_traits' detail class because
Borland C++ 5.5.1 wouldn't parse a partial specialization like:

  template<typename R>
  struct function_traits<R ()>;


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