I don't understand the syntax when a functor inherits from std::function:
class do_sth : public function< any_type (another_type) >
{
bool operator() (string s) {...}
};
What should I use as any_type and another_type? And can you give me an example of a beneficial usage of inheriting from std::function since I haven't understood it yet?
You should use the return type of your operator ()
for any_type
and the argument types for another_type
. Then at least it fits.
But really, std::function
is not meant to be inherited from, and doing so is probably a bad idea.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With