25#ifndef quantlib_money_hpp
26#define quantlib_money_hpp
122 Money operator+(const Money&, const Money&);
124 Money operator-(const Money&, const Money&);
126 Money operator*(const Money&, Decimal);
128 Money operator*(Decimal, const Money&);
130 Money operator/(const Money&, Decimal);
132 Decimal operator/(const Money&, const Money&);
135 bool operator==(const Money&, const Money&);
137 bool operator!=(const Money&, const Money&);
139 bool operator<(const Money&, const Money&);
141 bool operator<=(const Money&, const Money&);
143 bool operator>(const Money&, const Money&);
145 bool operator>=(const Money&, const Money&);
148 bool close(const Money&, const Money&, Size n = 42);
155 Money operator*(Decimal, const Currency&);
157 Money operator*(const Currency&, Decimal);
162 std::ostream& operator<<(std::ostream&, const Money&);
167 inline Money::Money(Currency currency, Decimal value)
168 : value_(value), currency_(std::move(currency)) {}
170 inline Money::Money(Decimal value, Currency currency)
171 : value_(value), currency_(std::move(currency)) {}
173 inline const Currency& Money::currency() const {
177 inline Decimal Money::value() const {
181 inline Money Money::rounded() const {
182 return Money(currency_.rounding()(value_), currency_);
185 inline Money Money::operator+() const {
189 inline Money Money::operator-() const {
190 return Money(-value_, currency_);
193 inline Money& Money::operator*=(Decimal x) {
198 inline Money& Money::operator/=(Decimal x) {
204 inline Money operator+(const Money& m1, const Money& m2) {
210 inline Money operator-(const Money& m1, const Money& m2) {
216 inline Money operator*(const Money& m, Decimal x) {
222 inline Money operator*(Decimal x, const Money& m) {
226 inline Money operator/(const Money& m, Decimal x) {
232 inline bool operator!=(const Money& m1, const Money& m2) {
236 inline bool operator>(const Money& m1, const Money& m2) {
240 inline bool operator>=(const Money& m1, const Money& m2) {
244 inline Money operator*(Decimal value, const Currency& c) {
245 return Money(value,c);
248 inline Money operator*(const Currency& c, Decimal value) {
249 return Money(value,c);
Per-session settings for the Money class.
const Money::ConversionType & conversionType() const
Money::ConversionType conversionType_
const Currency & baseCurrency() const
bool close(const Money &, const Money &, Size n=42)
Money & operator+=(const Money &)
Money & operator*=(Decimal)
const Currency & currency() const
Money & operator-=(const Money &)
bool close_enough(const Money &, const Money &, Size n=42)
Money & operator/=(Decimal)
global repository for run-time library settings
Basic support for the singleton pattern.
Real Decimal
decimal number
basic support for the singleton pattern
BaseCurrencyProxy & operator=(const Currency &)
ConversionTypeProxy & operator=(Money::ConversionType)