diff options
Diffstat (limited to 'impl/Complete.hpp')
-rw-r--r-- | impl/Complete.hpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/impl/Complete.hpp b/impl/Complete.hpp index e3ec15a..664d71f 100644 --- a/impl/Complete.hpp +++ b/impl/Complete.hpp @@ -99,6 +99,16 @@ struct Complete { template<typename Z> friend std::ostream& operator<<(std::ostream&, const Complete<Z>&); + template<typename S> + S as() const { + if (_infinity) { + if (_value > 0) + return infinity<S>(); + return -infinity<S>(); + } + return (S) _value; + } + private: T _value; bool _infinity; |