FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

GitHub Viewer

#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

Back | FazBrowse Home | New Git URL