|
Last change
on this file since 47 was
29,
checked in by landauf, 17 years ago
|
|
updated boost from 1_33_1 to 1_34_1
|
|
File size:
865 bytes
|
| Line | |
|---|
| 1 | /* Copyright Bruno da Silva de Oliveira 2003. Use, modification and |
|---|
| 2 | distribution is subject to the Boost Software License, Version 1.0. |
|---|
| 3 | (See accompanying file LICENSE_1_0.txt or copy at |
|---|
| 4 | http:#www.boost.org/LICENSE_1_0.txt) |
|---|
| 5 | */ |
|---|
| 6 | #ifndef OPERATORS_H |
|---|
| 7 | #define OPERATORS_H |
|---|
| 8 | |
|---|
| 9 | |
|---|
| 10 | namespace operators { |
|---|
| 11 | |
|---|
| 12 | struct C |
|---|
| 13 | { |
|---|
| 14 | static double x; |
|---|
| 15 | double value; |
|---|
| 16 | |
|---|
| 17 | const C operator+(const C other) const |
|---|
| 18 | { |
|---|
| 19 | C c; |
|---|
| 20 | c.value = value + other.value; |
|---|
| 21 | return c; |
|---|
| 22 | } |
|---|
| 23 | operator int() const |
|---|
| 24 | { |
|---|
| 25 | return (int)value; |
|---|
| 26 | } |
|---|
| 27 | |
|---|
| 28 | double operator()() |
|---|
| 29 | { |
|---|
| 30 | return C::x; |
|---|
| 31 | } |
|---|
| 32 | |
|---|
| 33 | double operator()(double other) |
|---|
| 34 | { |
|---|
| 35 | return C::x + other; |
|---|
| 36 | } |
|---|
| 37 | |
|---|
| 38 | operator const char*() { return "C"; } |
|---|
| 39 | }; |
|---|
| 40 | |
|---|
| 41 | inline const C operator*(const C& lhs, const C& rhs) |
|---|
| 42 | { |
|---|
| 43 | C c; |
|---|
| 44 | c.value = lhs.value * rhs.value; |
|---|
| 45 | return c; |
|---|
| 46 | } |
|---|
| 47 | |
|---|
| 48 | |
|---|
| 49 | } |
|---|
| 50 | |
|---|
| 51 | |
|---|
| 52 | #endif |
|---|
Note: See
TracBrowser
for help on using the repository browser.