RE: [Cppunit-devel] CppUnit 1.8.0 features...
Brought to you by:
blep
From: Baptiste L. <gai...@fr...> - 2001-09-25 12:57:00
|
Quoting "Summerwill, Bob" <BSu...@eu...>: > > Baptiste wrote: > > >> I would actually call that one a bug fix. While const is usefull when > > >> manipulating value object, it is a strong constraint. Personnaly, I > have > taken > >> Michael Feather's advice on XP and C++ and don't use const on > reference > object > >> (object who don't have public copy constructor). This make > refactoring a > lot > >> easier, but writing assertion_traits black magic :-(. > > Please could you clarify why you wouldn't want const references? > Maybe > provide > a link to Michael Feather's advice? > > I've always found const-correctness very useful, and would see > removing > const-correctness from CppUnit as a backwards step. There are a number > of > other > areas in the framework which I spotted as not being const-correct. Is > this > a > policy decision, that you aren't being const-correct? See other mail for urls. Note that the framework was first written by Michael Feather, who did not use const (which explain why the constness is shacky). I'm not saying to change CppUnit as a whole. The only thing I want to change is those part of CppUnit that would impose on the "user" policy: struct assertion_traits { static bool equal( const T& x, const T& y ) => change to static bool equal( T& x, T& y ) and template <class T> void assertEquals( const T& expected, const T& actual, => change to: template <class T> void assertEquals( T& expected, T& actual, The change is invisible for user that apply the "const" policy, and allow user who don't to use the assertEquals without having to do const_cast. Baptiste. > > > Cheers, > Bob > --- Baptiste Lepilleur <gai...@fr...> http://gaiacrtn.free.fr/index.html Language: English, French |