SourceForge.jp

stack_or_queue.h

説明を見る。
00001 
00002 
00011 #ifndef _dkutil_stack_or_queue
00012 #define _dkutil_stack_or_queue
00013 
00014 namespace dkutil{
00015 
00017 
00024 
00025 template<class T ,class CONTAINER=std::deque<T> >
00026 class stack_or_queue : public CONTAINER
00027 {
00028 public:
00029     typedef CONTAINER CONTAINER_TYPE;
00030     typedef CONTAINER BASE_TYPE;
00031     enum{
00032         enuSTACK = false,
00033         enuQUEUE = true,
00034     };
00035     stack_or_queue(bool flag=enuSTACK){m_flag=flag;}
00037     void push(const T& x){  
00038         BASE_TYPE::push_back(x);
00039     }
00041     void pop()
00042     {
00043         if(m_flag==enuSTACK){
00044             BASE_TYPE::pop_back();
00045         }else{
00046             BASE_TYPE::pop_front();
00047         }
00048     }
00049     void set_type(bool flag){
00050         m_flag=flag;
00051     }
00052 
00053     T &top(){ return BASE_TYPE::back(); }
00054     const T &top()const{return BASE_TYPE::back();}
00055 
00056 #ifndef BOOST_NO_PRIVATE_IN_AGGREGATE //なぜか boost 対応・・・
00057 protected:
00058 #endif
00059     bool m_flag;
00060 };
00061 
00062 
00063 }//end of dkutil namepsace
00064 
00065 #endif //end of include once

dkutil 1.02リリース前 d金魚専用マニュアルバージョンに対してSun Dec 28 21:23:08 2003に生成されました。 doxygen 1.3.5