【发布时间】:2020-02-12 16:01:18
【问题描述】:
我想知道是否可以用更简洁的方式编写以下冗长的命名空间用法:
#include <iostream>
#include <iomanip>
using std::ostream;
using std::cout;
using std::endl;
using std::ios;
using std::setw;
using std::setfill;
using std::hex;
说:
using std::{ostream,cout,endl,ios,setw,setfill,hex}; // hypothetically, of course
【问题讨论】:
-
简短回答:不。写
std::有什么大不了的吗?当您只使用限定名称时,它会导致更少的问题。
标签: c++ syntax namespaces std using