-
Leetcode-lrucache:力扣
资源介绍
lru缓存leetcode
力码
C++
STL
示例
队列(先进先出)
empty()
,
push()
,
front()
,
back()
,
pop()
,
swap()
,
size()
queue<
int
>
q;
cout
<<
"
Empty:
"
<<
q.empty()
<<
endl;
//
Stdout
----
Empty:
1
q.push(
1
);
q.push(
2
);
q.push(
3
);
cout
<<
"
Front:
"
<<
q.front()
<<
"
,
Back:
"
<<
q.back()
<<
endl;
//
Stdout
----
Front:
1,
Back:
3
q.pop();
cout
<<
"
Front:
"
<<
q.front()
<<
endl;
//
Stdout
----
Front:
2
queue<
int
>
q_;
q_.swap(q);
cout
<<
"
New
queue
size:
"
<<
q_.size()
<<
"
,
Old
queue
size:
"
<<
q.size()