close.cxx

Go to the documentation of this file.
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   v.push_back(-1.5);
00033   v.push_back(2.5);
00034   v.push_back(6.5);
00035   v.push_back(7.5);
00036   v.push_back(8.566);
00037   v.push_back(15.5);
00038   v.push_back(16.1);
00039   v.push_back(21.1);
00040   Dist distance = 3.;
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 

Generated on Fri Sep 21 13:20:37 2007 for AtlfastUtils by  doxygen 1.5.1