summaryrefslogtreecommitdiff
path: root/gmpxx.h
diff options
context:
space:
mode:
Diffstat (limited to 'gmpxx.h')
-rw-r--r--gmpxx.h24
1 files changed, 22 insertions, 2 deletions
diff --git a/gmpxx.h b/gmpxx.h
index 3a0684036..a218166d7 100644
--- a/gmpxx.h
+++ b/gmpxx.h
@@ -40,8 +40,7 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
// Use C++11 features
#ifndef __GMPXX_USE_CXX11
-#if (__cplusplus >= 201103L) \
- || (__GMP_GNUC_PREREQ(4, 6) && defined __GXX_EXPERIMENTAL_CXX0X__)
+#if __cplusplus >= 201103L
#define __GMPXX_USE_CXX11 1
#else
#define __GMPXX_USE_CXX11 0
@@ -1981,6 +1980,27 @@ typedef __gmp_expr<mpf_t, mpf_t> mpf_class;
+/**************** User-defined literals ****************/
+
+#if __GMPXX_USE_CXX11
+inline mpz_class operator"" _mpz(const char* s)
+{
+ return mpz_class(s);
+}
+
+inline mpq_class operator"" _mpq(const char* s)
+{
+ mpq_class q;
+ q.get_num() = s;
+ return q;
+}
+
+inline mpf_class operator"" _mpf(const char* s)
+{
+ return mpf_class(s);
+}
+#endif
+
/**************** I/O operators ****************/
// these should (and will) be provided separately