Boost logo

Boost Users :

Subject: Re: [Boost-users] more Boost::Units questions
From: Mark Volkmann (mark_at_[hidden])
Date: 2009-01-12 16:20:05


On Jan 9, 2009, at 5:33 PM, Matthias Schabel wrote:

>> My biggest issue is that my recent software development experience
>> has involved using Java much more than C++ and I'm trying to learn
>> how to use a C++ library that makes pretty heavy use of templates.
>> Is there a tutorial somewhere that shows examples of doing basic
>> things with this library? The kind of things
>
> The examples directory has simple, functional demonstrations of just
> about every type of functionality that anyone has wanted to date.

Okay, I've looked at the code related to conversions.
conversion_factor.cpp sets up a bunch of double values that I assume
are used to convert values in one unit to values in another. However,
they aren't used in any code.

>> - Does the library provide functions for converting between
>> different units? ... for example, converting from miles to
>> kilometers. If not, is there a recommended way to do this?
>
> Dimensionally consistent quantities can be converted by explicit
> construction or through conversion_factor. See the examples I listed
> earlier.

I don't see any example that actually performs a conversion using
conversion_factor. Can you show me how to use that to convert miles to
kilometers? It looks like kilometers isn't defined in any of the .hpp
files. I can just multiply meters by 1000 myself, but if there's
something in the library that hides this detail, I'd like to know
about it.

---
Mark Volkmann

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