/* ========================================================================== * ÀÛ ¼º ÀÚ : À̼ø±Ô * ÀÛ ¼º ÀÏ : 2007.02.06 * ³» ¿ë : std::vector¸¦ °¨½Ñ ¹è¿­ ÅÛÇø´ * ÁÖÀÇ»çÇ× : *===========================================================================*/ #pragma once #pragma warning( push ) //#pragma warning( disable: 4996 ) #pragma warning( disable: 4267 ) #include using namespace std; template class tArray; /// ¹è¿­ /// Çѹø ´Ã¾î³­ ¿ë·®(¼ö¿ë°¡´ÉÇÑ ÃÖ´ë ¿ø¼Ò ¼ö)Àº ÁÙ¾îµéÁö ¾Ê´Â´Ù. template class tArray : protected vector { typedef vector vector; typedef tArray cSelf; public: typedef T* cIterator; typedef const T* cConstIterator; public: /* explicit tArray(); explicit tArray( unsigned int size ); tArray( unsigned int size, const T& val ); tArray( const cSelf& other ); /// ¸ðµç ¿ø¼Ò¸¦ Á¦°Å void Clear(); /// n°³ÀÇ °ªÀ» ÇÒ´ç void Assign( unsigned int n, const T& val ); /// [first, last) ¹üÀ§ÀÇ °ªÀ» ÇÒ´ç void Assign( cIterator first, cIterator last ); /// ÃÖ´ë·Î ¼ö¿ë°¡´ÉÇÑ ¿ø¼ÒÀÇ ¼ö¸¦ ¼³Á¤ void Reserve( unsigned int capacity ); /// ¿ø¼Ò¸¦ ¸¶Áö¸·¿¡ Ãß°¡ void PushBack( const T& val ); /// ¸¶Áö¸· ¿ø¼Ò¸¦ Á¦°Å bool PopBack(); /// ÇØ´ç À妽ºÀÇ ¿ø¼Ò¸¦ Á¦°Å /// ÁÖÀÇ: ÇØ´ç À§Ä¡¿¡ ¸¶Áö¸· ¿ø¼Ò¸¦ º¹»çÇÑ ÈÄ, ¸¶Áö¸· ¿ø¼Ò¸¦ Á¦°ÅÇϹǷΠ/// ¿ø¼Ò¸¦ »ðÀÔÇÑ ¼ø¼­°¡ ¹Ù²ï´Ù. /// ¸¶Áö¸· ¿ø¼Ò¸¦ Á¦°ÅÇÑ °æ¿ì¿¡¸¸ ¼ø¼­°¡ À¯ÁöµÈ´Ù. bool PopAt( unsigned int i ); bool PopAt( bool* orderChanged, unsigned int i ); /// ½ÇÁ¦ ¿ø¼Ò ¼ö¸¦ ¼³Á¤ void Resize( unsigned int size ); void Resize( unsigned int size, const T& val ); /// ¹Ýº¹ÀÚ¸¦ ¸®ÅÏ cIterator Begin(); cConstIterator Begin() const; cIterator End(); cConstIterator End() const; /// ¿ø¼Ò¸¦ ¸®ÅÏ T& Front(); const T& Front() const; T& Back(); const T& Back() const; /// ÇØ´ç À妽ºÀÇ ¿ø¼Ò¸¦ ¸®ÅÏ /// À妽º°¡ ÀûÇÕÇÑ ¹üÀ§¸¦ ¹þ¾î³ª¸é false¸¦ ¸®ÅÏÇÑ´Ù. bool GetAt( T* val, unsigned int i ); /// Å©±â(¿ø¼Ò ¼ö)¸¦ ¸®ÅÏ unsigned int GetSize() const; /// ¿ë·®À» ¸®ÅÏ unsigned int GetCapacity() const; /// ºñ¾îÀÖ´ÂÁö ¿©ºÎ¸¦ ¸®ÅÏ bool IsEmpty() const; /// ÂüÁ¶ ¿¬»êÀÚ /// ÁÖÀÇ: À妽ºÀÇ ¹üÀ§¸¦ °Ë»çÇÏÁö ¾Ê´Â´Ù. T& operator [] ( unsigned int i ); const T& operator [] ( unsigned int i ) const; */ private: cSelf& operator = ( const cSelf& other ); private: /// ÁÖÀÇ: ¾Æ·¡ ÇÔ¼öµéÀº »ç¿ë ºóµµ°¡ ³·°Å³ª ºÎÇϸ¦ ¾ß±âÇϹǷΠÄÄÆÄÀÏ ±ÝÁö! /// ÇØ´ç À§Ä¡¿¡ °ªÀ» »ðÀÔ cIterator Insert( cIterator pos, const T& val ); /// ÇØ´ç À§Ä¡¿¡ [first, last) ¹üÀ§ÀÇ °ªÀ» »ðÀÔ void Insert( cIterator pos, cIterator first, cIterator last ); /// ÇØ´ç À§Ä¡¿¡ n°³ÀÇ °ªÀ» »ðÀÔ void Insert( cIterator pos, unsigned int n, const T& val ); /// ÇØ´ç À§Ä¡ÀÇ ¿ø¼Ò¸¦ »èÁ¦ cIterator Erase( cIterator pos ); /// [first, last) ¹üÀ§ÀÇ ¿ø¼Ò¸¦ »èÁ¦ cIterator Erase( cIterator first, cIterator last ); # include "Array.inl" }; #pragma warning( pop )