/* ========================================================================== * ÀÛ ¼º ÀÚ : À̼ø±Ô * ÀÛ ¼º ÀÏ : 2007.09.13 * ³» ¿ë : ¸Ê ÅÛÇø´ * ÁÖÀÇ»çÇ× : *===========================================================================*/ #pragma once #pragma warning( push ) #pragma warning( disable: 4267 ) #pragma warning( disable: 4311 ) #pragma warning( disable: 4996 ) #include #include "Pair.h" #include "Functor.h" using namespace std; /// ¸Ê /// Ű/°ª ½ÖÀ» ÇϳªÀÇ ¿ø¼Ò·Î Ãë±ÞÇÏ´Â ÄÁÅ×À̳ÊÀÌ´Ù. /// Áߺ¹µÈ ۸¦ Çã¿ëÇÏÁö ¾Ê´Â´Ù. /// Á¦°øµÈ Á¤·Ä ±âÁØ¿¡ µû¶ó¼­ ¿ø¼Ò¸¦ ÀÚµ¿À¸·Î Á¤·ÄÇÑ´Ù. template , class ALLOC = allocator< pair > > class tMap { public: typedef typename tPair cPair; private: typedef tMap cSelf; typedef _STLP_PRIV _MapTraitsT _MapTraits; typedef _STLP_PRIV _Rb_tree, _MapTraits, ALLOC> cTree; public: typedef typename cTree::iterator cIterator; typedef typename cTree::const_iterator cConstIterator; typedef typename cTree::allocator_type cAllocatorType; private: /// ÀûÈæ Æ®¸® cTree mTree; public: /* tMap(); /// ¸ðµç ¿ø¼ÒµéÀ» Á¦°Å void Clear(); /// µ¿ÀÏÇÑ Å°¸¦ °¡Áö´Â ù¹øÂ° ¿ø¼ÒÀÇ À§Ä¡¸¦ ¸®ÅÏ /// ¿ø¼Ò°¡ Á¸ÀçÇÏÁö ¾Ê´Â´Ù¸é End()¸¦ ¸®ÅÏ cIterator Find( const KEY& key ); cConstIterator Find( const KEY& key) const; /// ÇØ´ç Ű¿¡ °ªÀ» »ðÀÔ /// ½ÇÆÐÇϸé false¸¦ ¸®ÅÏÇÑ´Ù. bool Insert( const KEY& key, const T& val ); /// [first, last) ¹üÀ§ÀÇ ¿ø¼Ò¸¦ »ðÀÔ void Insert( const cPair* first, const cPair* last ); /// [first, last) ¹üÀ§ÀÇ ¿ø¼Ò¸¦ »ðÀÔ void Insert( cConstIterator first, cConstIterator last ); /// ÇØ´ç ۸¦ °¡Áö´Â ¿ø¼Ò¸¦ Á¦°Å /// Á¦°ÅµÈ ¿ø¼ÒÀÇ °³¼ö¸¦ ¸®ÅÏÇÑ´Ù. unsigned int Erase( const KEY& key ); /// posÀ§Ä¡ÀÇ ¿ø¼Ò¸¦ Á¦°Å void Erase( cIterator pos ); /// [first, last) ¹üÀ§ÀÇ ¿ø¼ÒµéÀ» Á¦°Å void Erase( cIterator first, cIterator last ); /// ¹Ýº¹ÀÚ¸¦ ¸®ÅÏ cIterator Begin(); cConstIterator Begin() const; cIterator End(); cConstIterator End() const; /// key¿¡ ÇØ´çÇÏ´Â °ªÀ» ¾ò¾î¿È /// ½ÇÆÐÇϸé false¸¦ ¸®ÅÏÇÑ´Ù. bool GetAt( T* val, const KEY& key ) const; /// µ¿ÀÏÇÑ key¸¦ °¡Áö´Â ¿ø¼ÒÀÇ °³¼ö¸¦ ¸®ÅÏ unsigned int GetCount( const KEY& key ) const; /// ¿ø¼Ò ¼ö¸¦ ¸®ÅÏ unsigned int GetSize() const; /// ºñ¾îÀÖ´ÂÁö ¿©ºÎ¸¦ ¸®ÅÏ bool IsEmpty() const; /// ÂüÁ¶ ¿¬»ê /// ÁÖÀÇ: ¿ø¼ÒÀÇ »ðÀÔÀÌ ¾Æ´Ñ °ªÀ» ¾ò´Â ¿ëµµ·Î¸¸ ¾ÈÀüÇÏ°Ô »ç¿ëÇØ¾ß ÇÑ´Ù. T& operator [] ( const KEY& key ); /// ÁÖÀÇ: ºÎÇϸ¦ ¾ß±âÇÒ ¼ö ÀÖÀ¸¹Ç·Î Á¶½ÉÇØ¼­ »ç¿ëÇÑ´Ù. tMap( const cSelf& other ); */ private: cSelf& operator = ( const cSelf& other ); # include "Map.inl" }; #pragma warning( pop )