自用快速STL兼容栈

版权声明:欢迎读者提问交流。 个人水平有限,表述不当或疏漏之处敬请批评指正。 作者:trialley 来源:CSDN 著作权归作者所有。非商业转载请注明出处,商业转载请联系作者获得授权。 https://blog.csdn.net/lgfx21/article/details/89298013
template<class T>
struct queue {
	int l = 0;
	int r = 0;
	T a [ 100000 ] ;
	void push(T x) {
		a[r] = x;
		r=r+1;
	}
	T front() {
		return a[l];
	}
	void pop() {
		if(l<r)l++;
	}
	bool empty() {
		if (l == r) 
			return true;
		return false;
	}
};

猜你喜欢

转载自blog.csdn.net/lgfx21/article/details/89298013