std :: list some of the functions Introduction (merge)

Merge List :: // // If the merger of two lists are ordered so after the merger is ordered // emphasized especially in the case of mergers vs10 list must be ordered #include <iostream> #include <List> Compare only Integral Part //: BOOL mycomparison (First Double, Double SECOND) {return (int (First) <int (SECOND));} int main () { STD :: List <Double> First, SECOND; first.push_back (3.1); first.push_back (2.2); first.push_back (2.9); second.push_back (3.7); second.push_back (7.1); second.push_back (1.4); first.sort (); second.sort () ; first.merge (SECOND,); // (SECOND, IS now empty) second.push_back (1.3); first.merge (SECOND,);
























 
 







std::cout << "first contains:";
for (std::list<double>::iterator it=first.begin(); it!=first.end(); ++it)
std::cout << ' ' << *it;
std::cout << '\n';


system("pause");
return 0;
}
Published 25 original articles · won praise 5 · Views 3224

Guess you like

Origin blog.csdn.net/Ellis1993/article/details/79721244