/***************************** PDI STD File ***********************************
This file is taken from external sources. this is taken from open source uClibc++ 
library available on github. below is reference link. Thanking to author for
providing this .

This is free software. you can redistribute it and/or modify it but without any
warranty.

referred from   : https://github.com/mike-matera/ArduinoSTL
added Date      : 1st Dec 2024
added by        : Suraj I.
******************************************************************************/

#include "basic_definitions"
#include "deque"

#ifndef __HEADER_PDISTD_STACK
#define __HEADER_PDISTD_STACK 1

#pragma GCC visibility push(default)

namespace pdistd{

	template <class T, class Container = deque<T> > class _UCXXEXPORT stack{
	protected:
		Container c;

	public:
		typedef typename Container::value_type	value_type;
		typedef typename Container::size_type	size_type;
		typedef Container			container_type;

		explicit stack(const Container& a = Container()) : c(a) {  }
		bool empty() const { return c.empty(); }
		size_type size() const { return c.size(); }
		value_type&       top() { return c.back(); }
		const value_type& top() const { return c.back(); }
		void push(const value_type& x) { c.push_back(x); }
		void pop() { c.pop_back(); }

		bool operator==(const stack<T, Container> &x) const{
			return  x.c == c;
		}

	};


	template <class T, class Container> _UCXXEXPORT bool
		operator< (const stack<T, Container>& x, const stack<T, Container>& y)
	{
		return (x.c < y.c);
	}
	template <class T, class Container> _UCXXEXPORT bool
		operator!=(const stack<T, Container>& x, const stack<T, Container>& y)
	{
		return (x.c != y.c);
	}
	template <class T, class Container> _UCXXEXPORT bool
		operator> (const stack<T, Container>& x, const stack<T, Container>& y)
	{
		return (x.c > y.c);
	}
	template <class T, class Container> _UCXXEXPORT bool
		operator>=(const stack<T, Container>& x, const stack<T, Container>& y)
	{
		return (x.c >= y.c);
	}
	template <class T, class Container> _UCXXEXPORT bool
		operator<=(const stack<T, Container>& x, const stack<T, Container>& y)
	{
		return (x.c <= y.c);
	}

}

#pragma GCC visibility pop

#endif


