Re: VC8 Compiler bizarreness

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Alex Blekhman wrote:
"Murrgon" wrote:
Correction to previous post: the 'built-in C++' operator!=() that were suggested obviously has that operator, but none of the classes suggested has that operator.

I think that the culprit is `GTL::TSmartPtr<TYPE>' template. Either it defines `operator !=', which is too generic or some other conversion operator that kicks in. Could you post the definition of this template?

It does define operator!=(), but the classes it's suggesting as the TYPE
don't.

namespace GTL {

// ===========================================================================
// TSmartPtr class
// ===========================================================================
template <class TYPE>
class TSmartPtr
{
// Member variables ========================================================
private:
TYPE* m_pRefCountObject; // Reference counting object

// <... snipped for brevity ...>

public:
// Boolean operators =====================================================
TBool operator!()
{
return(NULL == m_pRefCountObject);
}

TBool operator==(const TSmartPtr& kObject)
{
return(m_pRefCountObject == kObject.m_pRefCountObject);
}

TBool operator==(TYPE* ptr)
{
return(m_pRefCountObject == ptr);
}

TBool operator!=(const TSmartPtr& kObject)
{
return(m_pRefCountObject != kObject.m_pRefCountObject);
}

TBool operator!=(TYPE* ptr)
{
return(m_pRefCountObject != ptr);
}

friend INL TBool operator==(TYPE* ptr, const TSmartPtr<TYPE>& kObject)
{
return(kObject == ptr);
}

friend INL TBool operator!=(TYPE* ptr, const TSmartPtr<TYPE>& kObject)
{
return(kObject != ptr);
}
};


} // namespace GTL
.