From c029a456f410ef45f4803bc7e209fbab81b3c42a Mon Sep 17 00:00:00 2001 From: Olivier Gayot Date: Sat, 18 Nov 2017 13:43:31 +0100 Subject: Allow a number to be used in an ostream object When a number is streamed into a ostream object, the hexadecimal representation of the number is given to the stream. Signed-off-by: Olivier Gayot --- number.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'number.cpp') diff --git a/number.cpp b/number.cpp index 26b0ed2..acd60fd 100644 --- a/number.cpp +++ b/number.cpp @@ -145,3 +145,9 @@ number::operator!=(const number &n) const } /* }}} */ + +std::ostream & +operator<<(std::ostream &os, const number &n) +{ + return os << n.to_hex_string(); +} -- cgit v1.2.3