|
Boost Users : |
Subject: [Boost-users] [units] - overriding output
From: Noah Roberts (roberts.noah_at_[hidden])
Date: 2009-09-15 15:24:07
What is the correct way to override the << op for a unit so that it say
prints "Pa" instead of "m^-1 kg s^-2"?
I tried this and no worky:
#include <boost/units/io.hpp>
namespace boost { namespace units {
template<>
inline std::string
name_string< boost::units::pressure_dimension, boost::units::si::system
>(const boost::units::si::pressure&)
{
return "Pa";
}
}} // boost::units
Also, I note that the operator << in io.hpp has a comment saying
"INTERNAL USE ONLY". How would you suggest then that users of the
library provide for stream output without running afoul of this
implementation we're not meant to use?
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