00001
00002
00003 #include <algorithm>
00004 #include <vector>
00005 #include <iostream>
00006 #include <iterator>
00007 #include <cmath>
00008 #include <iomanip>
00009 #include "./Close.h"
00010 #include "./removeDistant.h"
00011 using namespace std;
00012
00013
00014 template <class Iter>
00015 void PrintThem(Iter vb, Iter ve){
00016 cout<<setw(8)<<setprecision(3);
00017 cout<<endl;
00018 cout<<" v: ";
00019 std::copy(vb, ve, ostream_iterator<int>(cout," ") );
00020 cout<<endl;
00021 }
00022
00023 int main(){
00024
00025 typedef int Type;
00026 typedef std::vector<Type> Container;
00027 typedef Type Dist;
00028
00029 Container v ;
00030 ostream_iterator<Type> out(cout," ");
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 v.push_back(1);
00043 v.push_back(2);
00044 v.push_back(3);
00045 v.push_back(4);
00046 v.push_back(20);
00047 v.push_back(21);
00048 v.push_back(30);
00049 int distance = 3;
00050
00051
00052 cout<<"** Initial **"<<endl;
00053 PrintThem(v.begin(), v.end() );
00054
00055 Container areClose
00056 = removeDistant<Close<Dist, Dist>, Container, Dist>(v, distance);
00057
00058 cout<<"** areClose **"<<endl;
00059 PrintThem(areClose.begin(), areClose.end() );
00060
00061 return 0;
00062 }
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072