当函子从std::function继承时,我不理解语法:
class do_sth : public function< any_type (another_type) >
{
bool operator() (string s) {...}
};
我应该使用什么作为any_type和another_type?您能给我一个示例,说明继承std::function的有益用法,因为我还没有理解它?
发布于 2015-01-15 03:34:01
您应该将operator ()
的返回类型用于any_type
,参数类型用于another_type
。那至少很合身。
但实际上,std::function
并不是要继承的,这样做可能是个坏主意。
https://stackoverflow.com/questions/27962420
复制