c++templatesboostboost-units

Boost::units::quantity "incomplete type" error


I am trying to use boost::units in a project but am running into trouble.

I have a template class which has some quantity objects as members. In one I wish to store a value with dimensions of pressure so I have quantity<pressure> press; declared as a member variable.

However this gives an error saying that quantity expects two template arguments (the source code shows the second template argument should default to double). If I then specify quantity<pressure,double> press; I instead get an error which says

Am I doing something wrong or is there a problem with the implementation of pressure somehow?

Minimal Example:

#include <boost/units/dimension.hpp>
#include <boost/units/systems/si/pressure.hpp>

using namespace boost::units;
using namespace boost::units::si;

struct MyClass
{
    quantity<pressure,double> press;    
};

Details:


Solution

  • I believe you need to include this:

    #include <boost/units/quantity.hpp>
    

    Coliru