Hi,
I have implemented a SmartPointer class following the implementation
proposed by Bill Hubauer(*). But I also override the operator * ()
template<class ObjectType>
class SmartPointer
{
public:
operator ObjectType * () const
{ return Pointer; }
....
private:
ObjectType* Pointer;
};
Now my compiler can compile:
SmartPointer<Ob ject> s = new Object;
delete s;
Is there a way to prevent that ?
Thanks,
Mathieu
(*)
Full source code is at:
I have implemented a SmartPointer class following the implementation
proposed by Bill Hubauer(*). But I also override the operator * ()
template<class ObjectType>
class SmartPointer
{
public:
operator ObjectType * () const
{ return Pointer; }
....
private:
ObjectType* Pointer;
};
Now my compiler can compile:
SmartPointer<Ob ject> s = new Object;
delete s;
Is there a way to prevent that ?
Thanks,
Mathieu
(*)
Full source code is at:
Comment