C++ 记录

发布时间 2023-11-01 19:26:04作者: 御坂夏铃

STL

队列(queue),一个先进先出的容器,需要用到头文件 queue

函数成员名 功能 返回值类型
que.empty() 判断队列是否为空,空返回真,非空返回假 bool
que.size() 返回队列中元素个数 unsigned long long
que.push() 将元素 \(x\) 放进队尾 void
que.front() 返回队首元素
que.back 返回队尾元素
que.pop() 弹出队首元素 void

杂项

通过头文件 typeinfo 中的 typeid(x).name() 判断 x 的数据类型。

类型 返回
bool b
short s
int i
unsigned int j
long l
unsigned long m
long long x
unsigned long long y
__in128 n
float f
double d
long double e
char c
string Ss
void v
typeid(x).name() PKc