Boost logo

Boost :

From: John Maddock (John_Maddock_at_[hidden])
Date: 2001-12-08 07:05:04


>What does that mean?
>
>How do I name a function type (as opposed to a reference or pointer to
function)?
>If I can't name a function type, can I produce one?

Normally you can only declare instances that have function type:

int foo(){}

"foo" is of type function.

But consider:

int foo();
template <class T> void bind(const T& t);

int main()
{
        bind(foo);
}

Here the call to template function bind deduces a template argument t as
"int (&)(void)", which makes template argument T a function type: "int
(void)". Wierd but true, albeit probably non-portable.

>And, to cap it all... it doesn't look like I can detect a member function
>pointer. Am I wrong? It looks like is_function doesn't return true for a
>member function.

No, it shouldn't - you can't dereference a member pointer, so there are no
references to member pointers, or types "member function pointer".

- John Maddock
http://ourworld.compuserve.com/homepages/john_maddock/


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