Boost logo

Boost :

From: Andy Little (andy_at_[hidden])
Date: 2006-06-08 05:39:37


"Leland Brown" wrote
> const sqrt_accel numer = sqrt(g);
> ...
> sqrt_length denom = sqrt(L);
> time result = numer / denom;

FWIW the result is a frequency, rather than a time. Nevertheless its a good
example !

The above can also be used to show utility of Boost.Typeof to work out the type
of sqrt_length with no effort:

#include <boost/pqs/t1_quantity/types/acceleration.hpp>
#include <boost/pqs/t1_quantity/types/length.hpp>
#include <boost/pqs/t1_quantity/types/frequency.hpp>
#include <boost/pqs/typeof_register.hpp>

using boost::pqs::length;
using boost::pqs::frequency;
using boost::pqs::acceleration;

int main()
{
    length::m L(1);
    acceleration::m_div_s2 g(1);
    BOOST_AUTO( numer, sqrt(g));
    BOOST_AUTO( denom , sqrt(L));
    frequency::Hz result = numer / denom;
}

regards
Andy Little


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk