Boost logo

Boost Users :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2006-05-10 03:00:05


chun ping wang wrote:

> Hmm i have a question, are there ways to get names of the function from
> boost::function..
>
> example i have
>
> void printfuncname(boost::function<void(int)> func)
> {
> do some code to print its name.
> }
>
> int main()
> {
> boost::function<void(int)> voidint
> voidint = &somefunc;
> printfuncname(func);
> }

This is not possible, because:

 1. Boost.Function object might not correspond to a function at all,
    but to a function object passed though boost::bind.
 2. Even if it corresponds to a function, getting the name is only
    possible using debug information, and it might not be available,
    and there's no portable lib to access debug information

- Volodya


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net