1
0
Fork 0

Update template.cc

Signed-off-by: subcrip <contact@subc.rip>
This commit is contained in:
subcrip 2024-09-21 17:47:31 +08:00
parent 1611a39e3e
commit d7f4e60492
1 changed files with 18 additions and 3 deletions

View File

@ -231,9 +231,24 @@ template<typename T, typename... U> void __read(T& x, U&... args) { cin >> x; __
#define deb(...) debug(make_tuple(__VA_ARGS__)) #define deb(...) debug(make_tuple(__VA_ARGS__))
/* pops */ /* pops */
#define poptop(q, ...) __AS_PROCEDURE(auto [__VA_ARGS__] = q.top(); q.pop();) template <typename Container>
#define popback(q, ...) __AS_PROCEDURE(auto [__VA_ARGS__] = q.back(); q.pop_back();) inline auto poptop(Container& q) {
#define popfront(q, ...) __AS_PROCEDURE(auto [__VA_ARGS__] = q.front();q.pop_front();) auto ret = q.top();
q.pop();
return ret;
}
template <typename Container>
inline auto popback(Container& q) {
auto ret = q.back();
q.pop_back();
return ret;
}
template <typename Container>
inline auto popfront(Container& q) {
auto ret = q.front();
q.pop_front();
return ret;
}
/* math */ /* math */
template <typename return_t> template <typename return_t>