Boost logo

Boost Users :

Subject: [Boost-users] [units] Unable to print temperature quantity
From: Belcourt, K. Noel (kbelco_at_[hidden])
Date: 2011-11-12 00:55:04


Hi,

I'm a complete neophyte with the units library. I have cause to use
it so I'm trying to do something simple and am getting compile
problems. This code:

#include <iostream>
#include <boost/units/io.hpp>
#include <boost/units/quantity.hpp>
#include <boost/units/systems/temperature/fahrenheit.hpp>

int main(int, char **) {
  using namespace boost::units;
  quantity<fahrenheit::temperature> t;
  std::cout << t << std::endl;
  return 0;
}

Generates this error with Intel 11.1 on Darwin using trunk.

/Users/kbelco/boost/boost/units/io.hpp(967): error: more than one
instance of overloaded function
"boost::units::detail::do_print_prefixed" matches the argument list:
            function template "void
boost
::units
::detail
::do_print_prefixed
<Prefixes,CharT,Traits,Dimension,System,T>(std::basic_ostream<_CharT,
_Traits> &, const boost::units::quantity<boost::units::unit<Dimension,
System, void>, T> &)"
            function template "void
boost
::units
::detail
::do_print_prefixed
<Prefixes,CharT,Traits,Unit,T>(std::basic_ostream<_CharT, _Traits> &,
const boost::units::quantity<Unit, T> &)"
            argument types are: (std::basic_ostream<char,
std::char_traits<char>>, const
boost::units::quantity<boost::units::fahrenheit::temperature, double>)
      detail::do_print_prefixed<Prefixes>(os, q);
      ^
          detected during:
            instantiation of "void
boost
::units
::detail
::maybe_print_prefixed
<Prefixes,CharT,Traits,Unit,T>(std::basic_ostream<_CharT, _Traits> &,
const boost::units::quantity<Unit, T> &, boost::mpl::true_) [with
Prefixes=boost::units::detail::engineering_prefixes, CharT=char,
Traits=std::char_traits<char>,
Unit=boost::units::fahrenheit::temperature, T=double]" at line 1050
            instantiation of "std::basic_ostream<_CharT, _Traits>
&boost::units::operator<<(std::basic_ostream<_CharT, _Traits> &, const
boost::units::quantity<Unit2, T2> &) [with Char=char,
Traits=std::char_traits<char>,
Unit=boost::units::fahrenheit::temperature, T=double]" at line 14 of "/
Users/kbelco/core_simulator/test/integration/main_test_5.cpp"

Any ideas what I'm doing wrong?

Thanks.

-- Noel Belcourt


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