aboutsummaryrefslogtreecommitdiff
path: root/Stack.hpp
blob: 8cfbdc36898d8f1eb240048bf8f2505d52434a6e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   Stack.hpp                                          :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: charles <charles.cabergs@gmail.com>        +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2020/04/25 21:39:53 by charles           #+#    #+#             */
/*   Updated: 2020/04/26 14:45:04 by charles          ###   ########.fr       */
/*                                                                            */
/* ************************************************************************** */

#ifndef STACK_HPP
# define STACK_HPP

# include "Vector.hpp"

namespace ft
{
	// template <class T, class Container = deque<T> >
	template <typename T>
	class Stack : public Vector<T>
	{
	public:
        typedef T  value_type;

		explicit Stack() : Vector<T>() {}
        Stack(const Stack& other) : Vector<T>(other) {}
        Stack& operator=(const Stack& other) { return Vector<T>::operator=(other); }
        ~Stack() {}

		value_type&       top()                       { return Vector<T>::back();  }
		const value_type& top() const                 { return Vector<T>::back();  }
		void              push(const value_type& val) { Vector<T>::push_back(val); }
		void              pop()                       { Vector<T>::pop_back();     }
	};
}

#endif