否则给定NN为std::distance(begin(), end()),RR为std::distance(other.begin(), other.end()): 1,2)应用最多N+R−1N+R−1次operator<进行比较。 3,4)应用最多N+R−1N+R−1次比较函数comp。 示例 运行此代码 #include <iostream>#include <list>std::ostream&operator<<(std::ostream&ostr...
operators (std::deque) operators (std::forward_list) operators (std::list) operators (std::map) operators (std::multimap) operators (std::multiset) operators (std::queue) operators (std::set) operators (std::stack) operators (std::unordered_map) operators (std::unordered_multimap) operator...
std::list<T,Allocator>::merge voidmerge(list&other); (1) voidmerge(list&&other); (2)(since C++11) template<classCompare> voidmerge(list&other, Compare comp); (3) template<classCompare> voidmerge(list&&other, Compare comp); (4)(since C++11) ...
1,2)用std::less<T>()(C++14 前)std::less<>()(C++14 起)比较元素。 3,4)用comp比较元素。 如果other或*this没有按对应的比较器有序,或者get_allocator()!=other.get_allocator(),那么行为未定义。 参数 other-要交换的另一容器 comp-比较函数对象(即满足比较(Compare)概念的对象),在第一参数小于(...
swap(std::forward_list) (C++11) erase(std::forward_list)erase_if(std::forward_list) (C++20)(C++20) Deduction guides(C++17) voidmerge(forward_list&other); (1)(since C++11) voidmerge(forward_list&&other); (2)(since C++11) template<classCompare> ...
类型Type1 与Type2 必须使得 list<T,Allocator>::const_iterator 类型的对象能在解引用后隐式转换到这两个类型。 返回值(无) 异常若抛出异常,则此函数无效果(强异常保证),除非异常来自比较函数。 复杂度至多std::distance(begin(), end()) + std::distance(other.begin(), other.end()) - 1 次比较...