Boost logo

Boost :

From: Chris Frey (cdfrey_at_[hidden])
Date: 2005-06-20 16:01:23


I recently had a need to investigate money classes. I searched for
such a beast, since I was sure I wasn't the first to have a need for this,
but it was only after I had coded up a good chunk of my own implementation
that I came across a boost mailing list thread involving
Martin <adrianm_at_...> and Daniel Frey:

Martin gives a link to his decimal classes here:

In's boost/decimal/money.hpp, I find the following code:

---- snip -------------------------------------------------------
# define BOOST_MONEY_OPERATOR(op, type) \
  template <class DecimalT> \
  inline money_base<DecimalT> operator##op(money_base<DecimalT> l, type r) { return l op= r; } \
  template <class DecimalT> \
  inline money_base<DecimalT> operator##op(type l, money_base<DecimalT> r) { return r op= l; }

---- snip -------------------------------------------------------

As far as I can see, the second item in the BOOST_MONEY_OPERATOR macro is
incorrect. Consider:

        money m = 2;
        5 - money(2);

This would result in:

        money(2) -= 5;

I'm happy to see some interest in money classes on the boost lists.
Is this project still being pursued?

- Chris

Boost list run by bdawes at, gregod at, cpdaniel at, john at