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
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
"name_string" and "symbol_string" aren't templated - they are
overloaded functions, so the template is not correct. Also, you
defined "name_string", which is for fully-formatted unit output (e.g.
"pascal" vs. "Pa"), so you are overloading the wrong function here.
The easy way is to include the SI IO header :
#include