32 typedef long size_type;
49 [[nodiscard]] size_type
size() const noexcept{
return m_size;}
58 [[nodiscard]] size_type
max_size() const noexcept{
return m_max_size;}
60 [[nodiscard]]
bool empty() const noexcept{
return m_size==0;};
66 m_front_ptr= m_tail_ptr=
new Node(x);
69 m_front_ptr = m_front_ptr->
next =
new Node(x,m_front_ptr);
77 m_front_ptr= m_tail_ptr=
new Node(x);
80 m_front_ptr = m_front_ptr->
next =
new Node(std::move(x),m_front_ptr);
88 m_front_ptr = m_tail_ptr =
new Node(x);
91 m_tail_ptr = m_tail_ptr->
prev =
new Node(x,
nullptr ,m_tail_ptr);
99 m_front_ptr = m_tail_ptr =
new Node(x);
102 m_tail_ptr = m_tail_ptr->
prev =
new Node(x,
nullptr ,m_tail_ptr);
111 m_front_ptr=m_tail_ptr=
nullptr;
113 m_front_ptr = m_front_ptr->
prev;
114 delete m_front_ptr->
next;
123 m_front_ptr=m_tail_ptr=
nullptr;
125 m_tail_ptr=m_tail_ptr->
next;
126 delete m_tail_ptr->
prev;
151 T &
at(size_type pos){
153 throw std::out_of_range(
"Out of range");
159 const T &
at(size_type pos)
const{
161 throw std::out_of_range(
"Out of range");
169 for (
int i = 0; i < pos ; ++i,++a);
175 for (
int i = 0; i < pos ; ++i,++a);
183 m_front_ptr(nullptr),
184 m_tail_ptr(nullptr) {}
191 m_front_ptr(nullptr){
202 std::swap(*
this, copy);
212 m_tail_ptr(x.m_tail_ptr),
213 m_front_ptr(x.m_front_ptr),
215 m_max_size(x.m_max_size)
218 x.m_tail_ptr=x.m_front_ptr=
nullptr;
227 std::swap(m_size, x.m_size);
228 std::swap(m_front_ptr, x.m_front_ptr);
229 std::swap(m_tail_ptr, x.m_tail_ptr);
243 m_front_ptr(nullptr){
267 template <
typename T>
284 template <
typename T>
290 current = current->next;
310 template <
typename T>
318 this->current=this->current->next;
334 #endif //DEQUE_DEQUE_H