28 bool operator== (
const T* pobj)
const {
return pobj==pObj; }
29 bool operator!= (
const T* pobj)
const {
return pobj!=pObj; }
34 SPtr(T* pobj=0) : pObj(pobj) {
35 if (pObj) { pObj->count++; }
38 if (pObj) { pObj->count++; }
42 if (
this == &ptr) {
return *
this; }
43 if (pObj && --(pObj->count) == 0) {
delete pObj; }
44 if ( (pObj=ptr.pObj) ) { pObj->count++; }
49 if (pObj && --(pObj->count) == 0) {
delete pObj; }
56template <
typename T,
int N>
class DArray;
58template <
typename T,
int N>
71 NIter(T* begin,
int last) : ptr(begin), idx(last) {}
78template <
typename T,
int N>
89 len = (len == N ? len : len+1);
95#ifdef USE_SMART_INSERT
101 memmove(&elems[last+1],&elems[last],(i-last)*
sizeof(T));
102 memset(&elems[last],0,
sizeof(T));
105 memmove(&elems[i],&elems[i+1],(last-i-1)*
sizeof(T));
106 memset(&elems[last-1],0,
sizeof(T));
113#ifndef USE_DIRTY_RESET
114 for (
int i=0; i<len; i++) {
122 static const int size = N;
133template <
typename T,
int N>
137 typedef std::auto_ptr<CArray>
Ptr;
150 static const int size = N;
std::auto_ptr< CArray > Ptr
const T & operator[](const int idx) const
const T & operator[](const int idx) const
bool operator==(const NIter &iter)
NIter(T *begin, int last)
bool operator!=(const NIter &iter)
NIter & operator+=(int n)
bool operator!=(const T *pobj) const
SPtr & operator=(const SPtr &ptr)
bool operator==(const T *pobj) const