32 #include "DGtal/base/Common.h"
33 #include "DGtal/base/CountedPtr.h"
37 using namespace DGtal;
48 unsigned int nbok = 0;
53 int *value=
new int(5);
55 nbok += p.unique() ? 1 : 0;
57 trace.
info() << p <<
" value=" << *p<< std::endl;
58 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
59 <<
"unique" << std::endl;
62 trace.
info() << p <<
" value=" << *p<< std::endl;
63 nbok += p.unique() ? 1 : 0;
65 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
66 <<
"unique" << std::endl;
74 bool testCountedPtrCopy()
76 unsigned int nbok = 0;
81 int *value=
new int(5);
83 nbok += p.unique() ? 1 : 0;
86 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
87 <<
"unique" << std::endl;
91 nbok += p.unique() ? 0: 1;
95 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
96 <<
"not unique anymore" << std::endl;
108 int main(
int argc,
char** argv )
112 for (
int i = 0; i < argc; ++i )
116 bool res = testCountedPtr() && testCountedPtrCopy();
117 trace.
emphase() << ( res ?
"Passed." :
"Error." ) << endl;