[Scummvm-cvs-logs] SF.net SVN: scummvm:[51064] tools/branches/gsoc2010-decompiler/decompiler/ stack.h

pidgeot at users.sourceforge.net pidgeot at users.sourceforge.net
Tue Jul 20 16:53:26 CEST 2010


Revision: 51064
          http://scummvm.svn.sourceforge.net/scummvm/?rev=51064&view=rev
Author:   pidgeot
Date:     2010-07-20 14:53:26 +0000 (Tue, 20 Jul 2010)

Log Message:
-----------
Reference- and constify stack class

Modified Paths:
--------------
    tools/branches/gsoc2010-decompiler/decompiler/stack.h

Modified: tools/branches/gsoc2010-decompiler/decompiler/stack.h
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/stack.h	2010-07-20 14:27:30 UTC (rev 51063)
+++ tools/branches/gsoc2010-decompiler/decompiler/stack.h	2010-07-20 14:53:26 UTC (rev 51064)
@@ -46,7 +46,7 @@
 	 *
 	 * @param item The item to push.
 	 */
-	void push(T item) { _stack.push_back(item); }
+	void push(const T &item) { _stack.push_back(item); }
 
 	/**
 	 * Pop an item from the stack and return it.
@@ -64,7 +64,14 @@
 	 *
 	 * @return The topmost item on the stack.
 	 */
-	T peek() { return _stack.back(); }
+	T &peek() { return _stack.back(); }
+
+	/**
+	 * Return the topmost item on the stack without removing it.
+	 *
+	 * @return The topmost item on the stack.
+	 */
+	const T &peek() const { return _stack.back(); }
 };
 
 #endif


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list