Bug 1044658 - 3/6 - make WeakPtr<const T> work - r=froydnj

This commit is contained in:
Benoit Jacob 2014-07-30 15:52:03 -04:00
parent dcd279dab4
commit 74bc5a0332

View File

@ -140,6 +140,12 @@ public:
return WeakPtr<T>(weakRef);
}
WeakPtr<const T> asWeakPtr() const
{
WeakPtr<T> p = const_cast<SupportsWeakPtr*>(this)->asWeakPtr();
return *reinterpret_cast<WeakPtr<const T>*>(&p);
}
protected:
~SupportsWeakPtr()
{
@ -160,7 +166,7 @@ template <typename T>
class WeakPtr
{
public:
WeakPtr(const WeakPtr<T>& aOther)
WeakPtr(const WeakPtr& aOther)
: mRef(aOther.mRef)
{}