Naios / function2

Improved and configurable drop-in replacement to std::function that supports move only types, multiple overloads and more
http://naios.github.io/function2
Boost Software License 1.0
539 stars 47 forks source link

Get pointer to target #28

Open optimizedaway opened 5 years ago

optimizedaway commented 5 years ago

@Naios

Great improvement over std::function, but there is no std::function::target counterpart. I use it for logging addresses of underlying callable objects, very useful for debugging:

...
catch (const std::exception &e)
{
    LOG_ERROR("Async function 0x%p raised exception: %s", f.target<void(*)(void)>(), e.what());
}

Any chance of implementing such feature?

Naios commented 5 years ago

Good suggestion, maybe this will be added in the future.