#include <iostream>
#include <deque>
using namespace std;
template<
typename T,
class Container = deque<T>
> class stack{
public:
using value_type = T;
using container_type = Container;
using reference = typename container_type::reference;
using const_reference = typename container_type::const_reference;
using size_type = ::size_t;
stack(const container_type &container_): container(container_){}
stack(container_type &&container_ = container_type()): container(container_){}
bool empty() const{
return container.empty();
}
size_type size() const{
return container.size();
}
reference &top(){
return container.back();
}
const reference &top() const{
return container.back();
}
void push(const value_type &val){
container.push_back(val);
}
void push(value_type &&val){
container.push_back(val);
}
template <class... Args>
void emplace(Args &&...args){
container.emplace_back(args...);
}
void pop(){
container.pop_back();
}
private:
container_type container;
};
template<typename T>
struct push_many_proxy{
using pushable_type = T;
using value_type = typename pushable_type::value_type;
pushable_type &pushable;
push_many_proxy(pushable_type &pushable_): pushable(pushable_){}
push_many_proxy &operator()(const value_type &val){
pushable.push(val);
return *this;
}
push_many_proxy &operator()(value_type &&val){
pushable.push(val);
return *this;
}
};
template<typename T>
push_many_proxy<T> push_many(T &pushable){
return push_many_proxy<T>(pushable);
}
int main(){
using nums_stack = stack<int>;
nums_stack nums;
push_many(nums)(1)(2)(3)(4)(5);
while(!nums.empty()){
cout << nums.top();
nums.pop();
}
return 0;
}