【发布时间】:2015-07-17 05:26:58
【问题描述】:
我想在命名空间中截获运算符
namespace Foo {
std::ostream& operator<<(std::ostream& os, bool b) {
//Can I call std::operator<< here now. Something like:
// os std::<< (b ? 10 : -10) << std::endl;
}
}
谢谢!
【问题讨论】:
-
std::operator<<(os, b ? 10 : -10);应该可以工作。 -
那不适用,
std::ostream是一个类对象……