看到的一些代码,看到不少陌生的函数。记录一点之前没怎么用过的c++的用法。
explicit operator bool() const { return state; }
int operator()(const cv::Mat &image);
显式的类型转换运算符(explicit)
为了防止四中的异常情况发生,C++11标准引入了显式的类型转换运算符explicit
显示转换之后,不能直接使用隐式规则对类进行类型转换,需要使用static_cast显式的对类进行转换
格式:通过explicit关键字定义
class SmallInt {
private:
std::size_t val;
public:
SmallInt(int i =