1,2) Equivalent to merge(other, std::less<T>())(until C++14)merge(other, std::less<>())(since C++14).3,4) Elements are compared using comp.If any of the following conditions is satisfied, the behavior is undefi
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) ...
returnostr;}intmain(){std::forward_list<int>list1={5,9,1,3,3};std::forward_list<int>list2={8,7,2,3,4,4};list1.sort();list2.sort();std::cout<<"list1: "<<list1<<'\n';std::cout<<"list2: "<<list2<<'\n';list1.merge(list2);std::cout<<"merged:"<<list1<<'\...
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 次比较...