Advertisement
Neveles

Untitled

Mar 29th, 2020
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.33 KB | None | 0 0
  1. template <class T>
  2. void QueueList<T>::enQueue(const T& e)
  3. {
  4.   if (tail_ == nullptr)
  5.   {
  6.     tail_ = new Node;
  7.     head_ = tail_;
  8.     tail_->value_ = e;
  9.     tail_->next_ = nullptr;
  10.   }
  11.   else
  12.   {
  13.     Node* newItem = new Node;
  14.     newItem->value_ = e;
  15.     newItem->next_ = nullptr;
  16.     tail_->next_ = newItem;
  17.     tail_ = newItem;
  18.   }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement