Boost logo

Boost Users :

Subject: Re: [Boost-users] [Units] help with type-safe unit-specific conversions
From: Justin Leonard (justinleona_at_[hidden])
Date: 2009-07-23 18:14:32


> Maybe I'm just not understanding your use case.

We have a GUI which allows users to choose units (from a fixed set) and input
values. The enumerations represent the unit set the user can choose.
There are two cases to handle:

1) User changes a value directly - "marshall" their input into the type system,
then push the unit-safe values into the model (as in model-view-control).

2) The model issues an update and the interface must update - take the unit-safe
values from the model, "demarshall" then to doubles whose value corresponds to
the users current type, and update the interface.

I just didn't recognize how to coerce a specific unit type. This problem was
solved via Mr. Watanabe's assistance, I just wanted to explain the case
sufficiently.

Thanks
Justin


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net