separate stack hpp and stack tpp
This commit is contained in:
@@ -21,25 +21,27 @@ public:
|
||||
* copliens :
|
||||
************/
|
||||
// constructors ------------------------------
|
||||
explicit stack(const container_type& cont = Container()) : c(cont) {}
|
||||
explicit stack(const container_type& cont = Container());
|
||||
|
||||
|
||||
/**********************
|
||||
* overload functions :
|
||||
**********************/
|
||||
// empty -------------------------------------
|
||||
bool empty() const { return c.empty(); }
|
||||
bool empty() const ;
|
||||
// size --------------------------------------
|
||||
size_type size() const { return c.size(); }
|
||||
size_type size() const ;
|
||||
// top ---------------------------------------
|
||||
value_type& top() { return c.back(); }
|
||||
const value_type& top() const { return c.back(); }
|
||||
value_type& top();
|
||||
const value_type& top() const ;
|
||||
// push --------------------------------------
|
||||
void push(const value_type& value) { c.push_back(value); }
|
||||
void push(const value_type& value);
|
||||
// pop ---------------------------------------
|
||||
void pop() { c.pop_back(); }
|
||||
void pop();
|
||||
|
||||
// Relational Operators (friend)
|
||||
/*********************************
|
||||
* 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 >
|
||||
@@ -58,36 +60,9 @@ protected:
|
||||
|
||||
};
|
||||
|
||||
|
||||
/************************
|
||||
* non-member functions :
|
||||
************************/
|
||||
// operator == -------------------------------
|
||||
template < typename T, typename Container >
|
||||
bool operator==(const stack<T, Container>& lhs, const stack<T, Container>& rhs)
|
||||
{ return lhs.c == rhs.c; }
|
||||
// operator != -------------------------------
|
||||
template < typename T, typename Container >
|
||||
bool operator!=(const stack<T, Container>& lhs, const stack<T, Container>& rhs)
|
||||
{ return lhs.c != rhs.c; }
|
||||
// operator < --------------------------------
|
||||
template < typename T, typename Container >
|
||||
bool operator<(const stack<T, Container>& lhs, const stack<T, Container>& rhs)
|
||||
{ return lhs.c < rhs.c; }
|
||||
// operator > --------------------------------
|
||||
template < typename T, typename Container >
|
||||
bool operator>(const stack<T, Container>& lhs, const stack<T, Container>& rhs)
|
||||
{ return lhs.c > rhs.c; }
|
||||
// operator <= -------------------------------
|
||||
template < typename T, typename Container >
|
||||
bool operator<=(const stack<T, Container>& lhs, const stack<T, Container>& rhs)
|
||||
{ return lhs.c <= rhs.c; }
|
||||
// operator >= -------------------------------
|
||||
template < typename T, typename Container >
|
||||
bool operator>=(const stack<T, Container>& lhs, const stack<T, Container>& rhs)
|
||||
{ return lhs.c >= rhs.c; }
|
||||
|
||||
} // namespace ft
|
||||
|
||||
# include "stack.tpp"
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user