为什么C++要求用户定义的转换运算符只能是非静态成员?为什么不允许像其他一元运算符一样使用独立函数?像这样的东西:
operator bool (const std::string& s) { return !s.empty(); }
c++
c++ ×1