Files
42_INT_11_ft_containers/headers/stack.hpp
2022-07-01 12:52:57 +02:00

69 lines
1.8 KiB
C++

#ifndef STACK_HPP
# define STACK_HPP
# include "vector.hpp"
namespace ft {
template <
typename T,
typename Container = ft::vector<T>
> class stack {
public:
typedef Container container_type;
typedef typename Container::value_type value_type;
typedef typename Container::size_type size_type;
/************
* copliens :
************/
// constructors ------------------------------
explicit stack(const container_type& cont = Container());
/**********************
* overload functions :
**********************/
// empty -------------------------------------
bool empty() const ;
// size --------------------------------------
size_type size() const ;
// top ---------------------------------------
value_type& top();
const value_type& top() const ;
// push --------------------------------------
void push(const value_type& value);
// pop ---------------------------------------
void pop();
/*********************************
* Relational Operators (friend) :
*********************************/
template < typename T2, typename C2 >
friend bool operator==(const stack<T2,C2>& lhs, const stack<T2,C2>& rhs);
template < typename T2, typename C2 >
friend bool operator!=(const stack<T2,C2>& lhs, const stack<T2,C2>& rhs);
template < typename T2, typename C2 >
friend bool operator<(const stack<T2,C2>& lhs, const stack<T2,C2>& rhs);
template < typename T2, typename C2 >
friend bool operator>(const stack<T2,C2>& lhs, const stack<T2,C2>& rhs);
template < typename T2, typename C2 >
friend bool operator<=(const stack<T2,C2>& lhs, const stack<T2,C2>& rhs);
template < typename T2, typename C2 >
friend bool operator>=(const stack<T2,C2>& lhs, const stack<T2,C2>& rhs);
protected:
container_type c;
};
} // namespace ft
# include "stack.tpp"
#endif