Boost logo

Boost :

From: Douglas Gregor (gregod_at_[hidden])
Date: 2003-02-13 08:18:13

On Thursday 13 February 2003 01:01 am, Lin Xu wrote:
> Attached is a prelimary replacement for function_traits.hpp. (When should I
> use the files section on yahoo? When should I attach? copy and paste code
> inline?)

If it's really short, post a context diff. If it's short, attach. If it's
longer than short, put it in the sandbox or files section.

> I added specializations for member function pointers, and for those
> specializations, a typedef class_type which is the class type of the
> pointer. For no-PTS compilers I added a set of template functions for
> function pointers.

I would have expected that for member function pointers arg1_type would be
  typedef cv class_type* arg1_type;

(where cv is the cv-qualifiers from the member function pointer).

> Unfortunely when I tried to test this by doing:
> cout << boost::function<void (A::*)()>::arity << endl;
> The following errors occured:
> main.cpp: In instantiation of `boost::function_traits<void (A::*)()>':
> main.cpp:33: instantiated from here
> main.cpp:33: base class `boost::detail::function_traits_helper<void
> (A::**)()>'
> has incomplete type
> It looks like the add_pointer doesn't know what to do with member function
> pointers.

It knows what to do, it just doesn't do what we want. The add_pointer should
only be performed when is_pointer<T>::value is false.

> This may affect many things, so I didn't touch anything else :)
> Would this affect boost::function? (from what I know it has some kind of
> member function pointer adaptor?)

It won't affect boost::function (which doesn't even use function_traits).
boost::signal could be affect, but only if function_traits stops working for
function types.


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