1

在查看 C++ 代码时,有时我会看到使用 of::std::ostream而不是简单地std::ostream

额外的两个::需要什么?

::std::ostream来自https://github.com/google/googletest/blob/master/googletest/docs/advanced.md#teaching-googletest-how-to-print-your-values的使用示例:

::std::ostream& operator<<(::std::ostream& os, const Bar& bar) {
  return os << bar.DebugString();  // whatever needed to print bar to os
}
4

0 回答 0