[Cppunit-cvs] cppunit2/include/cpput equality.h,1.3,1.4
Brought to you by:
blep
From: Baptiste L. <bl...@us...> - 2005-03-10 08:23:56
|
Update of /cvsroot/cppunit/cppunit2/include/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12038/include/cpput Modified Files: equality.h Log Message: * added mecanism similar to stringize to allow overload of equality testing. Index: equality.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/equality.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** equality.h 17 Nov 2004 08:59:05 -0000 1.3 --- equality.h 10 Mar 2005 08:23:45 -0000 1.4 *************** *** 25,34 **** template<typename AType, typename BType> bool equalityTest( const AType &a, const BType &b ) { ! return EqualityTraits<AType,BType>::equals( a, b ); } ! # ifdef CPPUT_HAS_TEMPLATE_PARTIAL_SPECIALIZATION template<typename AType, typename BType> --- 25,60 ---- + struct NoSpecificEqualityTest + { + }; + + + inline NoSpecificEqualityTest isEqual( ... ) + { + return NoSpecificEqualityTest(); + }; + + + namespace Impl { + template<typename AType, typename BType> + bool testIsEqual( const AType &, const BType &, bool isEqual ) + { + return isEqual; + } + + template<typename AType, typename BType> + bool testIsEqual( const AType &a, const BType &b, NoSpecificEqualityTest ) + { + return EqualityTraits<AType,BType>::equals( a, b ); + } + + } // namespace Impl + template<typename AType, typename BType> bool equalityTest( const AType &a, const BType &b ) { ! return Impl::testIsEqual( a, b, isEqual( &a, &b ) ); } ! # ifdef CPPUT_HAS_TEMPLATE_PARTIAL_SPECIALIZATION template<typename AType, typename BType> |