diff options
Diffstat (limited to 'impl/Complete.hpp')
-rw-r--r-- | impl/Complete.hpp | 30 |
1 files changed, 4 insertions, 26 deletions
diff --git a/impl/Complete.hpp b/impl/Complete.hpp index 336ab24..e3ec15a 100644 --- a/impl/Complete.hpp +++ b/impl/Complete.hpp @@ -7,38 +7,23 @@ template<typename T> T infinity() { } -template<typename T> -T unknown(const T&) { } template<typename T> struct Complete { Complete() - : _value(0), _infinity(false), _unknown(false) { } + : _value(0), _infinity(false) { } Complete(const T& value) - : _value(value), _infinity(false), _unknown(false) { } + : _value(value), _infinity(false) { } Complete(const T& value, const bool& infinity) - : _value(value), _infinity(infinity), _unknown(false) { + : _value(value), _infinity(infinity) { assert(value != 0 || infinity == false); } Complete(const Complete& other) - : _value(other._value), _infinity(other._infinity), _unknown(other._unknown) { } - Complete(const Complete& other, bool unknown) - : _value(other._value), _infinity(other._infinity), _unknown(unknown) { } - - Complete asUnknown() const { - return Complete(*this, true); - } - Complete asKnown() const { - return Complete(*this, false); - } - bool isUnknown() const { - return _unknown; - } + : _value(other._value), _infinity(other._infinity) { } Complete& operator=(const Complete& other) { _value = other._value; _infinity = other._infinity; - _unknown = other._unknown; return *this; } Complete& operator+=(const Complete& other) { @@ -117,7 +102,6 @@ struct Complete { private: T _value; bool _infinity; - bool _unknown; }; template<typename Z> @@ -130,8 +114,6 @@ std::istream& operator>>(std::istream& cin, Complete<Z>& num) { template<typename Z> std::ostream& operator<<(std::ostream& cout, const Complete<Z>& num) { - if (num._unknown) - cout << "(unknown)"; if (num._infinity) { cout << (num._value > 0 ? "inf" : "-inf"); } else { @@ -144,9 +126,5 @@ template<> Complete<int> infinity() { return Complete<int>(1, true); } -template<> -Complete<int> unknown(const Complete<int>& x) { - return Complete<int>(x, true); -} #endif |