Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » Rect_ operators overloading suggestion
Re: Rect_ operators overloading suggestion [message #13426 is a reply to message #13412] Sat, 05 January 2008 11:33 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 14267
Registered: November 2005
Ultimate Member
chickenk wrote on Fri, 04 January 2008 12:25

I would like to make a suggestion. I may have missed an important point so my suggestion would not make sense; don't hesitate to blame me for that. Smile

I can see these overloads:
Rect_& operator+=(Sz sz){ Offset(sz); return *this; }
Rect_& operator+=(Pt p) { Offset(p); return *this; }
[...]
Rect_& operator-=(Sz sz){ Offset(-sz); return *this; }
Rect_& operator-=(Pt p) { Offset(-p); return *this; }

I agree with the Pt-argumented functions but I think it would make more sense for Sz-argumented functions to modify the size of the Rectangle instead of translating it...

For example, the following code could be used (I've not tested it):
Rect_& operator+=(Sz sz){ SetSize(Size()+sz); return *this; }
[...]
Rect_& operator-=(Sz sz){ SetSize(Size()-sz); return *this; }

What do you think about it ?

regards,
Lionel



I think this classically ambiguos case.... I see good reasons for current overload as well for the proposed one...

Mirek
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: A couple of issues with a test app
Next Topic: Dynamic Variable Names
Goto Forum:
  


Current Time: Sun Aug 03 15:50:08 CEST 2025

Total time taken to generate the page: 0.06992 seconds