From: Andy Little (andy_at_[hidden])
Date: 2005-10-04 06:28:09
"John Torjo" <john.lists_at_[hidden]> wrote in message
>>>I might go further and add units (maybe defaulting to pixels)
>>>typedef gui::rect<px,int> rect 1;
>>>typedef gui::rect<pc,double> rect 2;
>>>typedef gui:rect<mm,int> rect 3;
>> That looks great :)!
> I disagree. I think you should stick to only one type (probably float
> for now, and eventually allow overriding it -- but, use this
> consistently throughout the app).
With all due respect users wont like having one style forced on them. Making the
value_type a template is trivial.
> Just think of the many places you'll need to deal with geometry
> (rectangle/point/size), and converting from one type of unit (px to cm,
> cm to in, etc) to another.
It seems like you are suggesting that users will go mad and use arbitrary units
all over the place just for the fun of it. I would guess that most developers
will use one unit that they are comfortable with. Conversion is common where
units are chosen by the application user . Most conversions would be to - from
pixels. Typically its the Americans ask to work in inches. Its actually trivial
to convert anyway. I dont really see what the fuss is about.
> And, about usability in code. Why would I want in my program, both:
> gui::rect<pc,double> and gui::rect<pc,int> ?
> This IMHO would confuse users of the library.
If you work in percent then usually you are happy with the granularity as an
integer between 0 and 100. Why use a float.? Actually I would also like to
have another unit which normalised the window dimensions to x= 1. and y =1.
Floats would make perfect sense then.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk