Boost logo

Boost Users :

Subject: Re: [Boost-users] Dynamically creating new units
From: OvermindDL1 (overminddl1_at_[hidden])
Date: 2009-12-25 13:01:51


On Fri, Dec 25, 2009 at 10:49 AM, Brandon Olivares
<programmer2188_at_[hidden]> wrote:
> Hi,
>
> Oh, sorry, I forgot to specify that I was talking about the Boost.Units
> library.
>
> Brandon
>
> On 2009-12-25, Brandon Olivares wrote:
>> Hi,
>>
>> I posted before about having a problem with having so many units that it
>> takes forever to install. I was thinking about trying to perhaps
>> dynamically create only the ones I need, because I can't know that at
>> compile-time.
>>
>> Mostly it would be scaled units. For instance I might have the unit
>> meter, but might want to create a scaled unit, say like kilometer or
>> millimeter.
>>
>> Also though I wouldn't mind being able to create some of the
>> astronomical units when necessary, such as parsec or light year. But
>> in all cases, the base units already exist.
>>
>> What would be the best way to do this?

First of all, please do not top post, here is a good reason why:
> A: Yes.
> > Q: Are you sure?
> >> A: Because it reverses the logical flow of conversation.
> >>> Q: Why is top posting annoying in email?
>
> If you are not convinced that it is wrong by the simple example above,
> now try to mix top and bottom posting:
>
> A: Yes.
> > Q: Are you sure?
> >>> Q: Why is top posting annoying in email?
> >> A: Because it reverses the logical flow of conversation.
>
> I don't know about you, but that's simply crazy!
>
> The correct way:
> >>> Q: Why is top posting annoying in email?
> >> A: Because it reverses the logical flow of conversation.
> > Q: Are you sure?
> A: Yes.

As for dynamically creating types, you can do that all you wish, but
you have no type information then (unless you use variant or any or
something, but that has needless overhead, well, maybe not variant).
That is the point of Boost.Units, to enforce that you are doing things
correctly, at compile time, it optimizes completely out at run-time.


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