void reverse() noexcept;
// reversing forward_list #include <iostream> #include <forward_list> int main () { std::forward_list<int> mylist = {10, 20, 30, 40}; mylist.reverse(); std::cout << "mylist contains:"; for (int& x: mylist) std::cout << ' ' << x; std::cout << '\n'; return 0; } |
forward_list::sort | 对容器中的元素进行排序(公众成员函数) |
forward_list::splice_after | 从另一个forward_list转移元素(公众成员函数) |
forward_list::swap | 交换内容(公众成员函数) |