libStatGen Software  1
InplaceMerge.cpp
00001 /*
00002  *  Copyright (C) 2010  Regents of the University of Michigan
00003  *
00004  *   This program is free software: you can redistribute it and/or modify
00005  *   it under the terms of the GNU General Public License as published by
00006  *   the Free Software Foundation, either version 3 of the License, or
00007  *   (at your option) any later version.
00008  *
00009  *   This program is distributed in the hope that it will be useful,
00010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *   GNU General Public License for more details.
00013  *
00014  *   You should have received a copy of the GNU General Public License
00015  *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
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
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends