版本比较
前所未有地释放你的性能:SmallVector
正文
增加 2 行删除 0 行
4 行未改动56789101112159 行未改动全部展开4 行未改动# Small vector 优化当对于长度较小的动态数组进行较多的操作时,`std::vector` 性能不佳。这里实现了一个 `SmallVector` 模板类,用一定的额外空间开销换取更优秀的时间。与[云剪贴板](https://www.luogu.com.cn/paste/uvubx1e9)同步。# $\textbf{Introduction}$159 行未改动全部展开4 行未改动567891011121314159 行未改动全部展开4 行未改动# Small vector 优化当对于长度较小的动态数组进行较多的操作时,`std::vector` 性能不佳。这里实现了一个 `SmallVector` 模板类,用一定的额外空间开销换取更优秀的时间。**2025.2.21 Update**:C++26 标准推出了相同功能(当然,更加完善)的容器——`std::inplace_vector`。见 [cppreference](https://zh.cppreference.com/w/cpp/container/inplace_vector)。与[云剪贴板](https://www.luogu.com.cn/paste/uvubx1e9)同步。# $\textbf{Introduction}$159 行未改动全部展开