Boost logo

Boost :

From: Paul Mensonides (pmenso57_at_[hidden])
Date: 2003-02-03 18:21:14

----- Original Message -----
From: "Daniel Frey" <d.frey_at_[hidden]>

> This not only leads to safer class detection, it also allows us to
> implement is_member_function without providing versions for every number
> of parameters.

This is already possible. The specialization...

R C::*

...matches all pointers-to-members, including pointers-to-member-functions.
However, when it *does* match a pointer-to-member-function, the type of 'R' is a
function type. Therefore, it is possible to detect a pointer-to-member-function
like this:

template<class> struct is_pointer_to_member_function {
    enum { value = false };

template<class R, class C> struct is_pointer_to_member_function<R C::*> {
    enum { value = is_same<void (R), void (R*)>::value };

...since only function types are implicitly adjusted to pointer-to-function when
used as a parameter.

Paul Mensonides

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