博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
C++ merge
阅读量:4136 次
发布时间:2019-05-25

本文共 649 字,大约阅读时间需要 2 分钟。

#include 
#include
#include
#include
#include
using namespace std;template
OutputIterator _merge (InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result){ while (true) { if (first1==last1) return copy(first2,last2,result); if (first2==last2) return copy(first1,last1,result); *result++ = (*first2<*first1)? *first2++ : *first1++; }}int main(){ array
t1 = {3,5,7,11,13,17,19,23}; array
t2 = {3,5,7,11,13,17,19,23}; array
t3; _merge(t1.begin(),t1.end(),t2.begin(),t2.end(),t3.begin()); for_each(t3.begin(),t3.end(),[](int i){cout<
<

转载地址:http://qfvvi.baihongyu.com/

你可能感兴趣的文章