FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
cppfront/include/cpp2ad_stack.h at main · hsutter/cppfront · GitHub
hsutter
/
cppfront
Public
Notifications
You must be signed in to change notification settings
Fork
269
Star
6k
Code
Issues
190
Pull requests
12
Discussions
Actions
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Discussions
Actions
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
cppfront
/
include
/
cpp2ad_stack.h
Copy path
More file actions
More file actions
Latest commit
History
History
History
38 lines (26 loc) · 636 Bytes
Breadcrumbs
cppfront
/
include
/
cpp2ad_stack.h
Copy path
File metadata and controls
38 lines (26 loc) · 636 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#
ifndef
CPP2_CPP2AD_STACK_H
#
define
CPP2_CPP2AD_STACK_H
#
include
<
vector
>
namespace
cpp2
{
struct
ad_stack
{
template
<
typename
T>
static
void
push
(T
const
& v) {
std::vector<T>& stack = get_stack<T>();
stack.
push_back
(v);
}
template
<
typename
T>
static
T
pop
() {
std::vector<T>& stack = get_stack<T>();
T v = stack.
back
();
stack.
pop_back
();
return
v;
}
private:
template
<
typename
T>
static
std::vector<T>&
get_stack
() {
static
std::vector<T> stack = {};
return
stack;
}
};
}
//
cpp2 namespace
#
endif
//
CPP2_CPP2AD_STACK_H
Back
|
FazBrowse Home
|
New Git URL