Go to the documentation of this file.00001 #include <iostream>
00002 #include "autoptr.h"
00003
00004 using namespace std;
00005 using namespace GMapping;
00006
00007 typedef autoptr<double> DoubleAutoPtr;
00008
00009 int main(int argc, const char * const * argv){
00010 double* d1=new double(10.);
00011 double* d2=new double(20.);
00012 cout << "Construction test" << endl;
00013 DoubleAutoPtr pd1(d1);
00014 DoubleAutoPtr pd2(d2);
00015 cout << *pd1 << " " << *pd2 << endl;
00016 cout << "Copy Construction" << endl;
00017 DoubleAutoPtr pd3(pd1);
00018 cout << *pd3 << endl;
00019 cout << "assignment" << endl;
00020 pd3=pd2;
00021 pd1=pd2;
00022 cout << *pd1 << " " << *pd2 << " " << *pd3 << " " << endl;
00023 cout << "conversion operator" << endl;
00024 DoubleAutoPtr nullPtr;
00025 cout << "conversion operator " << !(nullPtr) << endl;
00026 cout << "neg conversion operator " << nullPtr << endl;
00027 cout << "conversion operator " << (int)pd1 << endl;
00028 cout << "neg conversion operator " << !(pd1) << endl;
00029 }