From 3e792af86043c1414149cd05488a2bebe787c767 Mon Sep 17 00:00:00 2001 From: "kbr@google.com" Date: Fri, 12 Feb 2010 19:59:43 +0000 Subject: Fixed broken Linux build by changing Counter helper class used by NumElements() from a local class to a nested class as Gregg suggested in http://codereview.chromium.org/574024 . Changed this class to use DISALLOW_COPY_AND_ASSIGN. Review URL: http://codereview.chromium.org/606025 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38923 0039d316-1c4b-4281-b951-d872f2087c98 --- o3d/core/cross/gpu2d/red_black_tree.h | 42 +++++++++++++++++------------------ 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/o3d/core/cross/gpu2d/red_black_tree.h b/o3d/core/cross/gpu2d/red_black_tree.h index 17e1e0a..7dd7446 100644 --- a/o3d/core/cross/gpu2d/red_black_tree.h +++ b/o3d/core/cross/gpu2d/red_black_tree.h @@ -148,27 +148,6 @@ class RedBlackTree { // Returns the number of elements in the tree. int NumElements() { - // A Visitor which simply counts the number of visited elements. - class Counter : public Visitor { - public: - Counter() : count_(0) {} - - virtual void Visit(const T& data) { - ++count_; - } - - int count() { - return count_; - } - - private: - int count_; - // Using the DISALLOW_COPY_AND_ASSIGN macro for this local class - // breaks compilation on Windows because the declarations do not - // have method bodies. - Counter(const Counter&) {} - void operator=(const Counter&) {} - }; Counter counter; VisitInorder(&counter); return counter.count(); @@ -697,6 +676,27 @@ class RedBlackTree { } //---------------------------------------------------------------------- + // Helper class for NumElements() + + // A Visitor which simply counts the number of visited elements. + class Counter : public Visitor { + public: + Counter() : count_(0) {} + + virtual void Visit(const T& data) { + ++count_; + } + + int count() { + return count_; + } + + private: + int count_; + DISALLOW_COPY_AND_ASSIGN(Counter); + }; + + //---------------------------------------------------------------------- // Verification and debugging routines // -- cgit v1.1