#include template inline tDefragmentArray::tDefragmentArray() : vector() { mCount = 0; } template inline tDefragmentArray::tDefragmentArray( unsigned int size ) : vector( size ) { mCount = 0; } template inline tDefragmentArray::tDefragmentArray( const cSelf& other ) : vector( other ) { mCount = 0; } template inline T* tDefragmentArray::Begin() { return begin(); } template inline const T* tDefragmentArray::Begin() const { return begin(); } template inline T* tDefragmentArray::End() { return end(); } template inline const T* tDefragmentArray::End() const { return end(); } template inline T& tDefragmentArray::operator [] ( unsigned int i ) { return *(begin() + i); } template inline const T& tDefragmentArray::operator [] ( unsigned int i ) const { return *(begin() + i); } template inline unsigned int tDefragmentArray::Count() { return mCount; } template inline void tDefragmentArray::Insert(T val) { /// Ãß°¡µÉ°æ¿ì Ä«¿îÆ® 1Áõ°¡ push_back(val); ++mCount; } template inline bool tDefragmentArray::Erase(T val) { if( mCount <= 0 ) { /// 0ÀÌÇÏ »èÁ¦½Ã ¿À·ù return false; } cIterator i = begin(); cIterator End = end(); /// ¸¶Áö¸·À§Ä¡¿¡ ÇØ´çÇÏ´Â µ¥ÀÌÅÍÀÇ °ª cIterator lastdata = end(); --lastdata; /// Á¤»ó »èÁ¦ À¯¹« üũ bool check=false; for( ; i != End; ++i ) { /// ÀÔ·ÂÇÑ °ªÀÌ ÀÖ´Â °æ¿ì if( val == (*i) ) { /// º¤ÅÍÀÇ ¸¶Áö¸· °ªÀ» ÇöÀç À§Ä¡·Î º¹»ç (¸¶Áö¸·Àº ÈÄ¿¡ Áö¿ò) *i = *lastdata; check = true; break; } check = false; } /// °Ë»ö µÇÁö ¾ÊÀº°æ¿ì false if( check == false ) return false; /// °Ë»ö µÈ°æ¿ì ¸¶Áö¸·ÀÇ °ªÀ» Áö¿ö¹ö¸°´Ù. pop_back(); --mCount; return true; } template inline void tDefragmentArray::Clear() { cIterator i = begin(); cIterator End = end(); for( ; i != End; ++i ) { pop_back(); } mCount = 0; }