X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/b2e465d6d32d2dc884f58b94acb7e35f671a87fe..65ac6aad5f707849a127202f808d087d1fcaddc9:/apt-pkg/contrib/sptr.h diff --git a/apt-pkg/contrib/sptr.h b/apt-pkg/contrib/sptr.h index a9347edf9..ee4a65d60 100644 --- a/apt-pkg/contrib/sptr.h +++ b/apt-pkg/contrib/sptr.h @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: sptr.h,v 1.2 2001/02/20 07:03:17 jgg Exp $ +// $Id: sptr.h,v 1.3 2001/03/11 07:22:19 jgg Exp $ /* ###################################################################### Trivial non-ref counted 'smart pointer' @@ -20,9 +20,10 @@ /*}}}*/ #ifndef SMART_POINTER_H #define SMART_POINTER_H +#include template -class SPtr +class APT_DEPRECATED_MSG("use std::unique_ptr instead") SPtr { public: T *Ptr; @@ -43,24 +44,32 @@ class SPtr }; template -class SPtrArray +class APT_DEPRECATED_MSG("use std::unique_ptr instead") SPtrArray { public: T *Ptr; - inline T &operator *() {return *Ptr;}; + //inline T &operator *() {return *Ptr;}; inline operator T *() {return Ptr;}; inline operator void *() {return Ptr;}; inline T *UnGuard() {T *Tmp = Ptr; Ptr = 0; return Tmp;}; - inline T &operator [](signed long I) {return Ptr[I];}; + //inline T &operator [](signed long I) {return Ptr[I];}; inline void operator =(T *N) {Ptr = N;}; inline bool operator ==(T *lhs) const {return Ptr == lhs;}; inline bool operator !=(T *lhs) const {return Ptr != lhs;}; - inline T*Get() {return Ptr;}; + inline T *Get() {return Ptr;}; inline SPtrArray(T *Ptr) : Ptr(Ptr) {}; inline SPtrArray() : Ptr(0) {}; - inline ~SPtrArray() {delete []Ptr;}; +#if __GNUC__ >= 4 + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wunsafe-loop-optimizations" + // gcc warns about this, but we can do nothing here… +#endif + inline ~SPtrArray() {delete [] Ptr;}; +#if __GNUC__ >= 4 + #pragma GCC diagnostic pop +#endif }; #endif