你能解释一下这里的typedef在做什么和目的是什么?奇怪的布尔重载
class C
{
public:
...
typedef bool (C::*implementation_defined_bool_type)(bool) const;
operator implementation_defined_bool_type() const {
return _spi ? &C::isPersistent : 0;
}
};
这是过时[ “安全布尔” 成语]的实现(http://stackoverflow.com/questions/6242768/is-the-safe-bool-idiom -obsolete-在-C11)。 –