[wx-dev] wxRealRect implementation

Laurent Humbertclaude laurent.humbertclaude at gmail.com
Wed Apr 23 01:22:15 PDT 2008


>  LH> Time to change ?
>
>   Err, I don't think so. I forgot about that other patch but basically I
>  wrote the same reply to it, i.e. that if we need these classes we should
>  change wxRect to be a template instead of redoing them for another type.

Sorry, it was not supposed to be a blame, just a reminder.

I just have a wxRealRect in my own code too. So I think it will be a
usefull addition to wx ( warning: personal interest here !).
So I was looking to convert the wxPoint and wxRect to a templated
version myself,
But I just remind about VC6 problems with templates and looking at the WX
guidelines, I have a lots of questions:

Is it ok to use templates in a low level class like wxPoint, or event wxSize ?
Rule number One of the guideline is: Don't use C++ templates. I assume this
is ok to break rules as wxString already does in trunk.

- I am not sure if we want to merge wxPoint and wxPoint2DInt:
the wxPoint2DInt and wxPoint2DDouble are more a 2D vector than a point.

- On a more basic level, I have no clue of where to put the WXDLLIMPEXP_CORE
macro. Is a typedef class exported ? This will break ABI? ( do we care ?)

- What is the best solution for wxPoint<T>::operator== ?
We need a specialized version for double (and float) that calls wxIsSameDouble()
or we can change
  bool wxIsSameDouble(double x, double y)
to
  bool wxIsSame(double x, double y)
  bool wxIsSame(int x, int y) { //nop }
or also to
  bool wxIsSame<T>(T x, T y)
with a specialized version for double.

Regards,
Laurent

ps : Ok, re-reading myself, I found some answers in wx/string.h
 like WXDLLIMPEXP_BASE, and I am afraid that it will be more complicated
than I was thinking initialy to get a cross compiler version working.


More information about the wx-dev mailing list