Boost logo

Boost :

From: Martin (adrianm_at_[hidden])
Date: 2005-06-20 18:12:22

> 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;

You are right of course. The macro was only a quick fix for a VC70 bug. Other
compilers should use the operators library where the left subtraction is

I'm in the process of reworking the library. The focus has changed from
decimal arithmetic into money and currency.

The current library got basic_money and basic_currency classes based on a
money_traits class which handles the adaptation for the underlying arithmetic

template <typename ArithmeticT, typename TraitsT = money_traits<ArithmeticT> >
class basic_money;
template <typename MoneyT, typename CurrencyT = currency_type>
class basic_currency;

typedef basic_money<decimalF64> mymoney;
mymoney m(5.25, decimals(2), round_to_nearest);

const currency_type EUR("EUR"), USD("USD");
typedef basic_currency<basic_money<decimal64> > mycurrency;
mycurrency c(1.23, digits(3), EUR), d(1.23, "USD");

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