Update template.cc
Signed-off-by: subcrip <contact@subc.rip>
This commit is contained in:
parent
1611a39e3e
commit
d7f4e60492
21
template.cc
21
template.cc
|
@ -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>
|
||||||
|
|
Loading…
Reference in New Issue