diff options
author | vladlosev <vladlosev@861a406c-534a-0410-8894-cb66d6ee9925> | 2010-02-27 08:21:11 (GMT) |
---|---|---|
committer | vladlosev <vladlosev@861a406c-534a-0410-8894-cb66d6ee9925> | 2010-02-27 08:21:11 (GMT) |
commit | fe7876095950ad3be55babb27604d138fed4ec21 (patch) | |
tree | 16852104c3aae569b2100ad1351206b3f7178f45 /samples/sample3-inl.h | |
parent | 70eceaf8e7c6eb5c58838418db1768d8f08e53f5 (diff) | |
download | googletest-fe7876095950ad3be55babb27604d138fed4ec21.zip googletest-fe7876095950ad3be55babb27604d138fed4ec21.tar.gz googletest-fe7876095950ad3be55babb27604d138fed4ec21.tar.bz2 |
Makes all samples compile with -Wall -Wshadow -Werror.
Diffstat (limited to 'samples/sample3-inl.h')
-rw-r--r-- | samples/sample3-inl.h | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/samples/sample3-inl.h b/samples/sample3-inl.h index 630e950..46369a0 100644 --- a/samples/sample3-inl.h +++ b/samples/sample3-inl.h @@ -51,23 +51,23 @@ class QueueNode { public: // Gets the element in this node. - const E & element() const { return element_; } + const E& element() const { return element_; } // Gets the next node in the queue. - QueueNode * next() { return next_; } - const QueueNode * next() const { return next_; } + QueueNode* next() { return next_; } + const QueueNode* next() const { return next_; } private: // Creates a node with a given element value. The next pointer is // set to NULL. - QueueNode(const E & element) : element_(element), next_(NULL) {} + QueueNode(const E& an_element) : element_(an_element), next_(NULL) {} // We disable the default assignment operator and copy c'tor. - const QueueNode & operator = (const QueueNode &); - QueueNode(const QueueNode &); + const QueueNode& operator = (const QueueNode&); + QueueNode(const QueueNode&); E element_; - QueueNode * next_; + QueueNode* next_; }; template <typename E> // E is the element type. @@ -84,8 +84,8 @@ public: void Clear() { if (size_ > 0) { // 1. Deletes every node. - QueueNode<E> * node = head_; - QueueNode<E> * next = node->next(); + QueueNode<E>* node = head_; + QueueNode<E>* next = node->next(); for (; ;) { delete node; node = next; @@ -103,19 +103,19 @@ public: size_t Size() const { return size_; } // Gets the first element of the queue, or NULL if the queue is empty. - QueueNode<E> * Head() { return head_; } - const QueueNode<E> * Head() const { return head_; } + QueueNode<E>* Head() { return head_; } + const QueueNode<E>* Head() const { return head_; } // Gets the last element of the queue, or NULL if the queue is empty. - QueueNode<E> * Last() { return last_; } - const QueueNode<E> * Last() const { return last_; } + QueueNode<E>* Last() { return last_; } + const QueueNode<E>* Last() const { return last_; } // Adds an element to the end of the queue. A copy of the element is // created using the copy constructor, and then stored in the queue. // Changes made to the element in the queue doesn't affect the source // object, and vice versa. - void Enqueue(const E & element) { - QueueNode<E> * new_node = new QueueNode<E>(element); + void Enqueue(const E& element) { + QueueNode<E>* new_node = new QueueNode<E>(element); if (size_ == 0) { head_ = last_ = new_node; @@ -129,19 +129,19 @@ public: // Removes the head of the queue and returns it. Returns NULL if // the queue is empty. - E * Dequeue() { + E* Dequeue() { if (size_ == 0) { return NULL; } - const QueueNode<E> * const old_head = head_; + const QueueNode<E>* const old_head = head_; head_ = head_->next_; size_--; if (size_ == 0) { last_ = NULL; } - E * element = new E(old_head->element()); + E* element = new E(old_head->element()); delete old_head; return element; @@ -151,9 +151,9 @@ public: // returns the result in a new queue. The original queue is not // affected. template <typename F> - Queue * Map(F function) const { - Queue * new_queue = new Queue(); - for (const QueueNode<E> * node = head_; node != NULL; node = node->next_) { + Queue* Map(F function) const { + Queue* new_queue = new Queue(); + for (const QueueNode<E>* node = head_; node != NULL; node = node->next_) { new_queue->Enqueue(function(node->element())); } @@ -161,13 +161,13 @@ public: } private: - QueueNode<E> * head_; // The first node of the queue. - QueueNode<E> * last_; // The last node of the queue. + QueueNode<E>* head_; // The first node of the queue. + QueueNode<E>* last_; // The last node of the queue. size_t size_; // The number of elements in the queue. // We disallow copying a queue. - Queue(const Queue &); - const Queue & operator = (const Queue &); + Queue(const Queue&); + const Queue& operator = (const Queue&); }; #endif // GTEST_SAMPLES_SAMPLE3_INL_H_ |