C++ 特性笔记 / STL 使用笔记
pbds
ifdef 的用法
for (auto [x, y] : V)
关于几类 STL 容器的 swap
swap 的方式有 S1.swap(S2)
和 swap(S1, S2)
vector, map, set, deque 的 swap 时间复杂度是 \(\mathcal O(1)\) 的。
priority_queue, queue, stack 的 swap 时间复杂度是 \(\mathcal O(size)\) 的,但在开启 c++11 的情况下三种容器的 swap 可以做到 \(\mathcal O(1)\)
另外,对两个数组 swap 是 \(\mathcal O(size)\) 的,无论开不开 c++11。