Update of /cvsroot/mockpp/mockpp/mockpp/constraint
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22770/mockpp/constraint
Modified Files:
IsSame.h
Log Message:
comparison with template
Index: IsSame.h
===================================================================
RCS file: /cvsroot/mockpp/mockpp/mockpp/constraint/IsSame.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- IsSame.h 22 Sep 2005 18:34:19 -0000 1.18
+++ IsSame.h 23 Sep 2005 20:55:34 -0000 1.19
@@ -43,6 +43,22 @@
namespace mockpp {
+/** Default comparison function for \c IsSame.
+ * The default implementation compares the adresses of the two
+ * objects.
+ * @ingroup grp_constraint
+ * @see mockpp::same
+ * @param left left operand
+ * @param right right operand
+ * @return true if both operands are equal
+ */
+template <class T>
+bool isSameComparison(const T &left, const T &right)
+{
+ return &left == &right;
+}
+
+
/** Is the value the same object as another value?
* Basically the same as IsEqual because there is no reasonable
* distinction in C++ as opposed to Java.
@@ -73,7 +89,7 @@
*/
virtual bool eval( const T &arg ) const
{
- return arg == ref;
+ return isSameComparison(arg, ref);
}
/** Appends the description of this object to the buffer.
|