On Sun, Aug 08, 2004 at 02:31:16AM -0400, MenTaLguY wrote:
Have you measured the compile-time impact of having Traits::TreeIterator<SPObject *> in sp-object.h?
For developers, recompilation time is most significant. Separate headers means that changes to what might go in a separate header cause only sp-object.o to be rebuilt rather than most of inkscape.
They certainly do serve a documentation role as well.
For the most part better served by a comment.
However, an advantage of code over comment is that code is checked by the compiler.
That may depend on how many traits classes are typically needed at once, also. The number is going to increase, since there are some other distinctions/abstractions that I think are important.
If we decide to put each traits class in a separate header for the moment, then we can later add `#include the-separate-header' to whatever places we think appropriate wenn it becomes appropriate to do so.
One in particular is equality... I'm seriously considering adding a Traits::Eq template which draws a distinction between "equal" and "equivalent" similar to Scheme's equal? versus eqv?; I imagine most of the generic algorithms will end up using it.
The STL approach is to allow the user to specify a comparison predicate. We should use that approach in preference to different equality traits if we can.
pjrm.