知乎热榜 ( ) • 2024-04-08 21:24
d41d8c的回答

单目:: 反而可能会造成莫名其妙的bug。

#include <format>

struct MyType {};
template<>
constexpr ::std::range_format ::std::format_kind<MyType> = {}; // error
template<>
constexpr std::range_format std::format_kind<MyType> = {}; // OK


顺带表个态,我个人是能用using namespace std;就会用。现在有了模块,在一个模块单元里用的话是不会影响其他文件的。