In order to provide a simple "garbage collector" for my programs, I'm trying to write a template smart-pointer class, that may be used like that :
#include <ref.h>
class Foobar{ ....};
ref<Foobar> sample_manipulation(ref<Foobar> in)
{
ref<Foobar> f=in;
//....
return f;
}
int main(void)
{
ref<Foobar> f1=new Foobar;
ref<Foobar> f2;
f2=sample_manipulation(f1);
return 0;
}
I Just cannot compile the code : g++ says :
: error: no match for 'operator=' in 'f2 = sample_manipulations(ref<Foobar>)()'
ref.h:71: note: candidates are: ref<T>& ref<T>::operator=(ref<T>&) [with T = Foobar]
Does someone know where is the problem ?
Thanx