function2 icon indicating copy to clipboard operation
function2 copied to clipboard

Get pointer to target

Open optimizedaway opened this issue 6 years ago • 1 comments

@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?

optimizedaway avatar Sep 12 '19 21:09 optimizedaway

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

Naios avatar Sep 12 '19 22:09 Naios