InplaceMerge.cpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include "InplaceMerge.h"
00019
00020 #if defined(TEST)
00021 #include "iostream"
00022 #include "Generic.h"
00023
00024 int main(int argc, const char **argv)
00025 {
00026 int a[] = {1,2,3,4,5};
00027 int b[] = {2,4,6,7,10};
00028 int c[] = {3,5,8,10,11};
00029
00030 std::vector<int> z(15);
00031
00032 std::copy(a, a+5, z.begin());
00033 std::copy(b, b+5, z.begin() + 5);
00034 std::copy(c, c+5, z.begin() + 10);
00035
00036 std::vector<int> indeces, counts;
00037
00038 indeces.push_back(0);
00039 indeces.push_back(5);
00040 indeces.push_back(10);
00041
00042 counts.push_back(5);
00043 counts.push_back(5);
00044 counts.push_back(5);
00045
00046 inplace_merge(indeces, counts, 0, 3, z);
00047
00048 std::cout << z;
00049 }
00050
00051 #endif