diff options
author | Jonathan Wendeborn <jonathan.wendeborn@bruker.com> | 2018-10-16 08:38:34 +0200 |
---|---|---|
committer | Jonathan Wendeborn <jonathan.wendeborn@bruker.com> | 2018-10-16 08:38:34 +0200 |
commit | 96d16157721cda1fd6981e6ce70645acb44220da (patch) | |
tree | c68f2939aaf8904f06e7235dfa4607f167fbb758 /googletest/samples/sample3-inl.h | |
parent | 386391b0144201e0cf5f66d8ba1cb60a1076f673 (diff) | |
parent | 8c82ba48e433005b9e25835b4a342ef4dcc0cfc0 (diff) | |
download | googletest-96d16157721cda1fd6981e6ce70645acb44220da.tar.gz googletest-96d16157721cda1fd6981e6ce70645acb44220da.tar.bz2 googletest-96d16157721cda1fd6981e6ce70645acb44220da.zip |
Merge branch 'isnice' of https://github.com/BrukerJWD/googletest into isnice
Diffstat (limited to 'googletest/samples/sample3-inl.h')
-rw-r--r-- | googletest/samples/sample3-inl.h | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/googletest/samples/sample3-inl.h b/googletest/samples/sample3-inl.h index 7e3084d6..80ba6b92 100644 --- a/googletest/samples/sample3-inl.h +++ b/googletest/samples/sample3-inl.h @@ -28,8 +28,6 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // A sample program demonstrating using Google C++ testing framework. -// -// Author: wan@google.com (Zhanyong Wan) #ifndef GTEST_SAMPLES_SAMPLE3_INL_H_ #define GTEST_SAMPLES_SAMPLE3_INL_H_ @@ -60,7 +58,8 @@ class QueueNode { private: // Creates a node with a given element value. The next pointer is // set to NULL. - explicit QueueNode(const E& an_element) : element_(an_element), next_(NULL) {} + explicit QueueNode(const E& an_element) + : element_(an_element), next_(nullptr) {} // We disable the default assignment operator and copy c'tor. const QueueNode& operator = (const QueueNode&); @@ -74,7 +73,7 @@ template <typename E> // E is the element type. class Queue { public: // Creates an empty queue. - Queue() : head_(NULL), last_(NULL), size_(0) {} + Queue() : head_(nullptr), last_(nullptr), size_(0) {} // D'tor. Clears the queue. ~Queue() { Clear(); } @@ -88,12 +87,12 @@ class Queue { for (; ;) { delete node; node = next; - if (node == NULL) break; + if (node == nullptr) break; next = node->next(); } // 2. Resets the member variables. - head_ = last_ = NULL; + head_ = last_ = nullptr; size_ = 0; } } @@ -130,14 +129,14 @@ class Queue { // the queue is empty. E* Dequeue() { if (size_ == 0) { - return NULL; + return nullptr; } const QueueNode<E>* const old_head = head_; head_ = head_->next_; size_--; if (size_ == 0) { - last_ = NULL; + last_ = nullptr; } E* element = new E(old_head->element()); @@ -152,7 +151,8 @@ class Queue { template <typename F> Queue* Map(F function) const { Queue* new_queue = new Queue(); - for (const QueueNode<E>* node = head_; node != NULL; node = node->next_) { + for (const QueueNode<E>* node = head_; node != nullptr; + node = node->next_) { new_queue->Enqueue(function(node->element())); } |