Boost C++ Libraries of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.

Function template operator<<

boost::units::operator<< — Print a quantity.


// In header: <boost/units/io.hpp>

template<typename Char, typename Traits, typename Unit, typename T> 
  std::basic_ostream< Char, Traits > & 
  operator<<(std::basic_ostream< Char, Traits > & os, 
             const quantity< Unit, T > & q);


Prints the value followed by the unit. If the engineering_prefix, or binary_prefix is set, tries to scale the value appropriately. For example, it might print 12.345 km instead of 12345 m. (Note does not attempt to automatically scale scalars like double, float...)