Add operator->* to nsAutoPtr and nsRefPtr. (Bug 525205) Pending review, but fixes bustage for a bunch of people.

This commit is contained in:
L. David Baron 2009-10-29 21:04:32 -07:00
Родитель c53272b65f
Коммит dc40ce0d34
1 изменённых файлов: 26 добавлений и 0 удалений

Просмотреть файл

@ -184,6 +184,19 @@ class nsAutoPtr
return get();
}
// This operator is needed for gcc <= 4.0.* and for Sun Studio; it
// causes internal compiler errors for some MSVC versions. (It's not
// clear to me whether it should be needed.)
#ifndef _MSC_VER
template <class U, class V>
U&
operator->*(U V::* aMember)
{
NS_PRECONDITION(mRawPtr != 0, "You can't dereference a NULL nsAutoPtr with operator->*().");
return get()->*aMember;
}
#endif
#ifdef CANT_RESOLVE_CPP_CONST_AMBIGUITY
// broken version for IRIX
@ -1085,6 +1098,19 @@ class nsRefPtr
return get();
}
// This operator is needed for gcc <= 4.0.* and for Sun Studio; it
// causes internal compiler errors for some MSVC versions. (It's not
// clear to me whether it should be needed.)
#ifndef _MSC_VER
template <class U, class V>
U&
operator->*(U V::* aMember)
{
NS_PRECONDITION(mRawPtr != 0, "You can't dereference a NULL nsRefPtr with operator->*().");
return get()->*aMember;
}
#endif
#ifdef CANT_RESOLVE_CPP_CONST_AMBIGUITY
// broken version for IRIX