34#ifndef GTEST_SAMPLES_SAMPLE3_INL_H_
35#define GTEST_SAMPLES_SAMPLE3_INL_H_
50 friend class Queue<E>;
54 const E&
element()
const {
return element_; }
63 explicit QueueNode(
const E& an_element) : element_(an_element), next_(NULL) {}
77 Queue() : head_(NULL), last_(NULL), size_(0) {}
91 if (node == NULL)
break;
102 size_t Size()
const {
return size_; }
120 head_ = last_ = new_node;
123 last_->next_ = new_node;
137 head_ = head_->next_;
143 E* element =
new E(old_head->
element());
152 template <
typename F>
155 for (
const QueueNode<E>* node = head_; node != NULL; node = node->next_) {
156 new_queue->
Enqueue(function(node->element()));
const QueueNode< E > * Head() const
Queue * Map(F function) const
const QueueNode< E > * Last() const
void Enqueue(const E &element)
const QueueNode * next() const
const E & element() const