/ CPP_Modules / CPP_Module_08 / ex02 / MutantStack.tpp
MutantStack.tpp
  1  /* ************************************************************************** */
  2  /*                                                                            */
  3  /*                                                        :::      ::::::::   */
  4  /*   MutantStack.tpp                                    :+:      :+:    :+:   */
  5  /*                                                    +:+ +:+         +:+     */
  6  /*   By: gychoi <gychoi@student.42seoul.kr>         +#+  +:+       +#+        */
  7  /*                                                +#+#+#+#+#+   +#+           */
  8  /*   Created: 2023/12/31 01:42:26 by gychoi            #+#    #+#             */
  9  /*   Updated: 2023/12/31 01:50:49 by gychoi           ###   ########.fr       */
 10  /*                                                                            */
 11  /* ************************************************************************** */
 12  
 13  #ifndef __MUTANTSTACK_TPP__
 14  #define __MUTANTSTACK_TPP__
 15  
 16  /* ************************************************************************** */
 17  /*                          Constructor & Destructor                          */
 18  /* ************************************************************************** */
 19  
 20  template <typename T>
 21  MutantStack<T>::MutantStack()
 22  	: std::stack<T>()
 23  {
 24  	// nothing to do
 25  }
 26  
 27  template <typename T>
 28  MutantStack<T>::MutantStack(MutantStack const& other)
 29  	: std::stack<T>(other)
 30  {
 31  	// nothing to do
 32  }
 33  
 34  template <typename T>
 35  MutantStack<T>&	MutantStack<T>::operator=(MutantStack const& other)
 36  {
 37  	if (this != &other)
 38  	{
 39  		this->std::stack<T>::operator=(other);
 40  	}
 41  	return *this;
 42  }
 43  
 44  template <typename T>
 45  MutantStack<T>::~MutantStack()
 46  {
 47  	// nothing to do
 48  }
 49  
 50  /* ************************************************************************** */
 51  /*                           Public Member Function                           */
 52  /* ************************************************************************** */
 53  
 54  template <typename T>
 55  typename std::stack<T>::container_type::iterator	MutantStack<T>::begin()
 56  {
 57  	return this->c.begin();
 58  }
 59  
 60  template <typename T>
 61  typename std::stack<T>::container_type::iterator	MutantStack<T>::end()
 62  {
 63  	return this->c.end();
 64  }
 65  
 66  template <typename T>
 67  typename std::stack<T>::container_type::const_iterator
 68  MutantStack<T>::begin() const
 69  {
 70  	return this->c.begin();
 71  }
 72  
 73  template <typename T>
 74  typename std::stack<T>::container_type::const_iterator
 75  MutantStack<T>::end() const
 76  {
 77  	return this->c.end();
 78  }
 79  
 80  template <typename T>
 81  typename std::stack<T>::container_type::reverse_iterator
 82  MutantStack<T>::rbegin()
 83  {
 84  	return this->c.rbegin();
 85  }
 86  
 87  template <typename T>
 88  typename std::stack<T>::container_type::reverse_iterator
 89  MutantStack<T>::rend()
 90  {
 91  	return this->c.rend();
 92  }
 93  
 94  template <typename T>
 95  typename std::stack<T>::container_type::const_reverse_iterator
 96  MutantStack<T>::rbegin() const
 97  {
 98  	return this->c.rbegin();
 99  }
100  
101  template <typename T>
102  typename std::stack<T>::container_type::const_reverse_iterator
103  MutantStack<T>::rend() const
104  {
105  	return this->c.rend();
106  }
107  
108  #endif /* __MUTANTSTACK_TPP__ */