c++ concurrency in action 3.3cpp


#include <deque>
template<typename T, typename Container = std::deque<T> >
class stack
{
public:
	explicit stack(const Container&);
	explicit stack(Container&& = Container());
	template <class Alloc> explicit stack(const Alloc&);
	template <class Alloc> stack(const Container&, const Alloc&);
	template <class Alloc> stack(Container&&, const Alloc&);
	template <class Alloc> stack(stack&&, const Alloc&);

	bool empty() const;
	size_t size() const;
	T& top();
	T const& top() const; 
	void push(T const&);
	void push(T&&);
	void pop();//pop很可能发生在top 和empty之间 可以在用top的时候检查throw exception,然后又得empty empty又有potential risk
	void swap(stack&&);
};

int main()
{}

猜你喜欢

转载自blog.csdn.net/fly1ng_duck/article/details/81094608