STL

standard template library

1328 rilak




Why STL?



Fast  easy

standard

Safety




How to use STL?




#include<>

using namespace std;




about type

stack<int> S;

queue<double> Q;





          struct IPJ{

           int rilak;

           int betaveros;

          };


stack<IPJ> QAQ;



About Name

Stack --> S

Queue --> Q

Priority_Queue -->PQ

Vector --> Vec

(vector通常會出現在圖論中,所以大多會用圖論專有名詞)




Stack




#include<stack>




using namespace std;




stack<int>  S;




S.push(1)




S.top()




S.pop()




S.empty()

S.size()==0

!S.size()





Queue




#include<queue>

using namespace std;




queue<int>  Q;




Q.push(X)




Q.front()




Q.empty()

Q.size() == 0

!Q.size()





priority_queue



PQ

#include<queue>

using namespace std;

priority_queue<int> PQ;

PQ.push();    front();     pop();

PQ.empty()

自己推!

STL

By rilak1328

STL

  • 1,041