Boost logo

Boost Users :

Subject: Re: [Boost-users] more Boost::Units questions
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2009-01-12 16:48:35


AMDG

Mark Volkmann wrote:
> 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.

conversion_factor isn't used for conversions. It just returns the value
that
would be used for a conversion.

> 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.

http://www.boost.org/doc/html/boost_units/Examples.html#boost_units.Examples.ConversionExample
The example uses SI and CGS, but converting between any units is similar.

In Christ,
Steven Watanabe


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