Problem compiling CAutoRef_AC from ACS classes
Problem compiling CAutoRef_AC from ACS classes
- Subject: Problem compiling CAutoRef_AC from ACS classes
- From: Matt Gough <email@hidden>
- Date: Fri, 12 May 2006 11:19:22 +0100
I am only one compiler error away from converting my CodeWarrior
project to XCode, but am a bit stumped.
I am unable to compile CMPThread_AC from the old ACS classes as it
gives errors against CAutoRef_AC. A cut down version of the necessary
stuff is below.
It gives an error against any usage of fPointee in CAutoRef_AC saying
'fPointee' was not declared in scope.
Unfortunatley, my knowledge of templates has not been updated in the
last few years so I don't know if the code is no longer valid or if
it is a compiler bug. I tried the obvious thing of making fPointee
public but it made no difference.
Any help would be much appreciated
Matt Gough
template <class REF>
class CSimpleRef_AC
{
public:
CSimpleRef_AC(REF ptr = NULL)
: fPointee(ptr)
{ }
REF get() const
{ return fPointee; }
operator REF () const
{ return fPointee; }
protected:
REF fPointee;
};
//
========================================================================
================
// class CAutoRef_AC
//
========================================================================
================
template <class REF, class DELETER>
class CAutoRef_AC : public CSimpleRef_AC<REF>
// this class owns the object pointed by fPointee
{
public:
CAutoRef_AC(REF ptr = NULL)
// default constructor
// Assumes ownership of ptr. Will delete ptr upon destruction of
the AutoPtr.
: CSimpleRef_AC<REF>(ptr)
{ }
void operator = (REF ptr)
// Assumes ownership of ptr after delete fPointee if fPointee is not
// NULL. Will delete ptr upon destruction of the AutoPtr.
{
if(fPointee != ptr) // << 'fPointee' was not declared in scope
{
reset();
fPointee = ptr;
}
}
void reset()
// Sets the pointer to NULL after deleting the data if its not NULL.
{
DELETER::DeleteRef(fPointee); // << 'fPointee' was not declared in
scope
fPointee = NULL;
}
};
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden