| [ Web Proxy ] |
| Viewing: https://raw.githubusercontent.com/hsutter/cppfront/main/include/cpp2ad_stack.h | [Back] [Original] |
#ifndef CPP2_CPP2AD_STACK_H
#define CPP2_CPP2AD_STACK_H
#include
namespace cpp2 {
struct ad_stack {
template
static void push(T const& v) {
std::vector& stack = get_stack();
stack.push_back(v);
}
template
static T pop() {
std::vector& stack = get_stack();
T v = stack.back();
stack.pop_back();
return v;
}
private:
template
static std::vector& get_stack() {
static std::vector stack = {};
return stack;
}
};
} // cpp2 namespace
#endif // CPP2_CPP2AD_STACK_H
| Web Proxy Viewer | New URL | Original Page |