mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 809931 - make Static{Auto,Ref}Ptr have trivial constructors and destructors; r=jlebar
This commit is contained in:
parent
e042b3ba4f
commit
93cadceec0
@ -35,14 +35,15 @@ template<class T>
|
||||
class StaticAutoPtr
|
||||
{
|
||||
public:
|
||||
// In debug builds, check that mRawPtr is initialized for us as we expect
|
||||
// by the compiler. In non-debug builds, don't declare a constructor
|
||||
// so that the compiler can see that the constructor is trivial.
|
||||
#ifdef DEBUG
|
||||
StaticAutoPtr()
|
||||
{
|
||||
// In debug builds, check that mRawPtr is initialized for us as we expect
|
||||
// by the compiler.
|
||||
MOZ_ASSERT(!mRawPtr);
|
||||
}
|
||||
|
||||
~StaticAutoPtr() {}
|
||||
#endif
|
||||
|
||||
StaticAutoPtr<T>& operator=(T* rhs)
|
||||
{
|
||||
@ -72,8 +73,13 @@ class StaticAutoPtr
|
||||
}
|
||||
|
||||
private:
|
||||
// Disallow copy constructor.
|
||||
// Disallow copy constructor, but only in debug mode. We only define
|
||||
// a default constructor in debug mode (see above); if we declared
|
||||
// this constructor always, the compiler wouldn't generate a trivial
|
||||
// default constructor for us in non-debug mode.
|
||||
#ifdef DEBUG
|
||||
StaticAutoPtr(StaticAutoPtr<T> &other);
|
||||
#endif
|
||||
|
||||
void Assign(T* newPtr)
|
||||
{
|
||||
@ -90,14 +96,15 @@ template<class T>
|
||||
class StaticRefPtr
|
||||
{
|
||||
public:
|
||||
// In debug builds, check that mRawPtr is initialized for us as we expect
|
||||
// by the compiler. In non-debug builds, don't declare a constructor
|
||||
// so that the compiler can see that the constructor is trivial.
|
||||
#ifdef DEBUG
|
||||
StaticRefPtr()
|
||||
{
|
||||
MOZ_ASSERT(!mRawPtr);
|
||||
}
|
||||
|
||||
~StaticRefPtr()
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
StaticRefPtr<T>& operator=(T* rhs)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user