Hi,
I think I am beginning to get the boost:units library, but I still have one
problem. Consider:
#include <iostream>
#include
#include
#include
#include
#include
#include
#include
// Introduce slot (measured in e.g. ffe or tfe) as a basic dimension, unit and
in a system
struct slot_base_dimension :
boost::units::base_dimension
{ };
typedef slot_base_dimension::dimension_type slot_dimension;
struct ffe_base_unit : public boost::units::base_unit
{
static std::string name() { return("40ft equivalent"); }
static std::string symbol() { return("ffe"); }
};
typedef ffe_base_unit::unit_type slot_t;
BOOST_UNITS_STATIC_CONSTANT(ffe, slot_t);
/// derived dimension (slot) flow
typedef
boost::units::derived_dimension::type
flow_dimension;
/// placeholder class defining si unit system
typedef boost::units::make_system::type unit_system;
typedef boost::units::unit flow_t;
BOOST_UNITS_STATIC_CONSTANT(ffe_per_second, flow_t);
int main() {
boost::units::quantity flow(4*ffe_per_second);
std::cout << "flow= " << flow << std::endl;
}
This program outputs
flow= 4 s^-1 ffe
which is correct, but a bit unusual... 4 ffe/s or even 4 ffe s^-1 would have
been better. Is this possible?
Thanks!
--
kind regards, Esben