I've got a task pool using threads which is trying to call a boost::function that happens to be purely virtual, without an implementation.

Is there anything like this?

void doStuff(boost::function<void()> foo) 
{
    if (!foo.pure_virtual) 
    {
        foo();
    }
}

Note: This isn't the same as foo.empty or if (foo) { }. The .empty API doesn't seem to detect the pure virtual-ness of the method.

有帮助吗?

解决方案

You cannot detect it, and you shouldn't have it in there in the first place!

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top