Boost logo

Boost :

From: Noah Roberts (roberts.noah_at_[hidden])
Date: 2007-12-14 14:35:50


It would appear that there's something wrong with this macro. I've
looked at it and I'm not sure how it happens...

In a precompiled header I'm including a system of units I'm creating.
Some are simply composites of fundamental dimensions that are missing,
such as volumetric flow, but others are different dimensions, such as
currency.

Some of the files that include this precompiled header use time(), the C
function. However, if I use BOOST_UNITS_STATIC_CONSTANT to instantiate
the unit for currency, which I'm pasting below, with VC++ 8, it pulls
the time dimension into the global namespace. This of course causes the
whole project to fail since that's where time() lives. If I just create
a static variable this doesn't happen.

What was the problem with static variables that necessitates a
BOOST_UNITS_STATIC_CONSTANT?

I'm using the mcs units from the vault, has this problem been fixed or
even noticed before? Is there a report of changes to mcs that I can view?

#pragma once

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

namespace esi
{
   namespace units
   {
     using namespace boost::units;

     namespace systems
     {
       namespace SI
       {
         using namespace boost::units::SI;

         struct currency_tag : ordinal<11> {}; // dimension tag for currency
         typedef fundamental_dimension<currency_tag>::type currency_type;
         typedef unit<currency_tag, SI::system> currency;

         //BOOST_UNITS_STATIC_CONSTANT(coin, currency);
         static currency const coin;
       }
     }
   }
}


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk