From: Sven Verdoolaege Date: Fri, 9 Jan 2009 11:43:30 +0000 (+0100) Subject: add std::ostream &operator<<(std::ostream &os, isl_int i) (for C++ builds) X-Git-Tag: isl-0.01~310 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ee8dd79bf2d202ad326a5d2a209d5cb7e07c55fa;p=platform%2Fupstream%2Fisl.git add std::ostream &operator<<(std::ostream &os, isl_int i) (for C++ builds) --- diff --git a/include/isl_int.h b/include/isl_int.h index ddb2422..274aee9 100644 --- a/include/isl_int.h +++ b/include/isl_int.h @@ -4,6 +4,9 @@ #include #include #include +#if defined(__cplusplus) +#include +#endif #if defined(__cplusplus) extern "C" { @@ -88,4 +91,17 @@ uint32_t isl_gmp_hash(mpz_t v, uint32_t hash); } #endif +#if defined(__cplusplus) +static inline std::ostream &operator<<(std::ostream &os, isl_int i) +{ + char *s; + void (*gmp_free)(void *, size_t); + s = mpz_get_str(0, 10, i); + os << s; + mp_get_memory_functions(NULL, NULL, &gmp_free); + (*gmp_free)(s, strlen(s)+1); + return os; +} +#endif + #endif