From 01eb8253196672c969a39587e90b49321a182428 Mon Sep 17 00:00:00 2001 From: Daniel Wilhelm Date: Fri, 18 Apr 2014 17:19:14 +0200 Subject: 5.1 --- zen/fixed_list.h | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'zen/fixed_list.h') diff --git a/zen/fixed_list.h b/zen/fixed_list.h index 1b2af5bf..eedbfab9 100644 --- a/zen/fixed_list.h +++ b/zen/fixed_list.h @@ -18,13 +18,13 @@ class FixedList { struct Node { - Node() : next(NULL), val() {} - template Node(A&& a) : next(NULL), val(a) {} - template Node(A&& a, B&& b) : next(NULL), val(a, b) {} - template Node(A&& a, B&& b, C&& c) : next(NULL), val(a, b, c) {} - template Node(A&& a, B&& b, C&& c, D&& d) : next(NULL), val(a, b, c, d) {} - template Node(A&& a, B&& b, C&& c, D&& d, E&& e) : next(NULL), val(a, b, c, d, e) {} - template Node(A&& a, B&& b, C&& c, D&& d, E&& e, F&& f) : next(NULL), val(a, b, c, d, e, f) {} + Node() : next(nullptr), val() {} + template Node(A&& a) : next(nullptr), val(a) {} + template Node(A&& a, B&& b) : next(nullptr), val(a, b) {} + template Node(A&& a, B&& b, C&& c) : next(nullptr), val(a, b, c) {} + template Node(A&& a, B&& b, C&& c, D&& d) : next(nullptr), val(a, b, c, d) {} + template Node(A&& a, B&& b, C&& c, D&& d, E&& e) : next(nullptr), val(a, b, c, d, e) {} + template Node(A&& a, B&& b, C&& c, D&& d, E&& e, F&& f) : next(nullptr), val(a, b, c, d, e, f) {} Node* next; //singly linked list is sufficient T val; @@ -32,8 +32,8 @@ class FixedList public: FixedList() : - first(NULL), - lastInsert(NULL), + first(nullptr), + lastInsert(nullptr), sz(0) {} ~FixedList() @@ -51,7 +51,7 @@ public: class ListIterator : public std::iterator { public: - ListIterator(NodeT* it = NULL) : iter(it) {} + ListIterator(NodeT* it = nullptr) : iter(it) {} ListIterator& operator++() { iter = iter->next; return *this; } inline friend bool operator==(const ListIterator& lhs, const ListIterator& rhs) { return lhs.iter == rhs.iter; } inline friend bool operator!=(const ListIterator& lhs, const ListIterator& rhs) { return !(lhs == rhs); } @@ -90,7 +90,7 @@ public: template void remove_if(Predicate pred) { - Node* prev = NULL; + Node* prev = nullptr; Node* ptr = first; while (ptr) @@ -102,7 +102,7 @@ public: prev->next = ptr = tmp; else first = ptr = tmp; - if (tmp == NULL) + if (!tmp) lastInsert = prev; } else @@ -113,7 +113,7 @@ public: } void clear() { remove_if([](T&) { return true; }); } - bool empty() const { return first == NULL; } + bool empty() const { return first == nullptr; } size_t size() const { return sz; } private: @@ -123,14 +123,14 @@ private: void pushNode(Node* newNode) { ++sz; - if (lastInsert == NULL) + if (lastInsert == nullptr) { - assert(first == NULL); + assert(first == nullptr); first = lastInsert = newNode; } else { - assert(lastInsert->next == NULL); + assert(lastInsert->next == nullptr); lastInsert->next = newNode; lastInsert = newNode; } -- cgit