Replace GiNaC::ToString() with std::to_string().
authorRichard Kreckel <kreckel@ginac.de>
Sun, 8 Nov 2015 21:19:08 +0000 (22:19 +0100)
committerRichard Kreckel <kreckel@ginac.de>
Sun, 8 Nov 2015 21:19:08 +0000 (22:19 +0100)
And, while at it, also make CMake exercise the new real_imag exam
introduced last week and document successful build with GCC-4.8.

INSTALL
check/CMakeLists.txt
ginac/CMakeLists.txt
ginac/Makefile.am
ginac/archive.cpp
ginac/function.cppy
ginac/numeric.cpp
ginac/symbol.cpp
ginac/tostring.h [deleted file]

diff --git a/INSTALL b/INSTALL
index e3fdb7bfda3f1277d1ececd9398f7fce18dfaa1a..635ec4b67b9a2ed74fd0a01401cc7d925299439c 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -20,7 +20,7 @@ TeX are necessary.
 
 Known to work with:
  - Linux on x86 and x86_64 using 
-   - GCC 4.9, 5.1, and 5.2
+   - GCC 4.8, 4.9, 5.1, and 5.2
    - Clang 3.5.0
 
 Known not to work with:
index 5bf53a19669c1e75f55eaa43f32fa29d5e305bd8..58f9736b2a7536c32cfa04b6e1285c6bd6ad8234 100644 (file)
@@ -33,6 +33,7 @@ set(ginac_tests
        exam_misc
        exam_mod_gcd
        exam_cra
+       exam_real_imag
        bugme_chinrem_gcd
        factor_univariate_bug
        pgcd_relatively_prime_bug
index ed6ac1199133ca8e59099135240e316691aded8a..c872aad3848dd15c2c8afe7ab42093fe62e5a18b 100644 (file)
@@ -111,7 +111,6 @@ set(ginaclib_public_headers
 
 set(ginaclib_private_headers
     remember.h
-    tostring.h
     utils.h
     crc32.h
     hash_seed.h
index 4c83ffd44a0e21cae3988baaa410b934195916cd..6f9fe7489f421b14bc2f524cadba598d3aa9fc4d 100644 (file)
@@ -9,7 +9,7 @@ libginac_la_SOURCES = add.cpp archive.cpp basic.cpp clifford.cpp color.cpp \
   operators.cpp power.cpp registrar.cpp relational.cpp remember.cpp \
   pseries.cpp print.cpp symbol.cpp symmetry.cpp tensor.cpp \
   utils.cpp wildcard.cpp \
-  remember.h tostring.h utils.h crc32.h hash_seed.h compiler.h \
+  remember.h utils.h crc32.h hash_seed.h compiler.h \
   parser/parse_binop_rhs.cpp \
   parser/parser.cpp \
   parser/parse_context.cpp \
index ffd8b58a41a426cf08ffca449b493c78047dc516..6a973775005435d5ce3617515f6d4557cfac8ae8 100644 (file)
@@ -27,7 +27,6 @@
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
-#include "tostring.h"
 #include "version.h"
 
 #include <iostream>
@@ -272,7 +271,7 @@ std::istream &operator>>(std::istream &is, archive &ar)
        static const unsigned min_version = GINACLIB_ARCHIVE_VERSION - GINACLIB_ARCHIVE_AGE;
        unsigned version = read_unsigned(is);
        if ((version > max_version) || (version < min_version))
-               throw (std::runtime_error("archive version " + ToString(version) + " cannot be read by this GiNaC library (which supports versions " + ToString(min_version) + " thru " + ToString(max_version)));
+               throw (std::runtime_error("archive version " + std::to_string(version) + " cannot be read by this GiNaC library (which supports versions " + std::to_string(min_version) + " thru " + std::to_string(max_version)));
 
        // Read atoms
        unsigned num_atoms = read_unsigned(is);
index f04b21b743cb447505dfbd877e2999755bc7e2c5..0876f9cf955bfabe56154554c96eaef0b6e31f12 100644 (file)
@@ -34,7 +34,6 @@
 #include "power.h"
 #include "archive.h"
 #include "inifcns.h"
-#include "tostring.h"
 #include "utils.h"
 #include "hash_seed.h"
 #include "remember.h"
@@ -878,7 +877,7 @@ unsigned function::find_function(const std::string &name, unsigned nparams)
                        return serial;
                ++serial;
        }
-       throw (std::runtime_error("no function '" + name + "' with " + ToString(nparams) + " parameters defined"));
+       throw (std::runtime_error("no function '" + name + "' with " + std::to_string(nparams) + " parameters defined"));
 }
 
 /** Return the print name of the function. */
index 2102e94b6086e4ce146bbb7d9ea8731a5f31a97f..209cb7000b0db6043293245303003782334462f4 100644 (file)
@@ -32,7 +32,6 @@
 #include "ex.h"
 #include "operators.h"
 #include "archive.h"
-#include "tostring.h"
 #include "utils.h"
 
 #include <limits>
@@ -225,7 +224,7 @@ numeric::numeric(const char *s)
                        // E to lower case
                        term = term.replace(term.find("E"),1,"e");
                        // append _<Digits> to term
-                       term += "_" + ToString((unsigned)Digits);
+                       term += "_" + std::to_string((unsigned)Digits);
                        // construct float using cln::cl_F(const char *) ctor.
                        if (imaginary)
                                ctorval = ctorval + cln::complex(cln::cl_I(0),cln::cl_F(term.c_str()));
index 4dd0691c648ac435b4ef60cbaf1074f6fed28ff5..446a27fef9dca78dc4077329957e90311027d6d3 100644 (file)
@@ -23,7 +23,6 @@
 #include "symbol.h"
 #include "lst.h"
 #include "archive.h"
-#include "tostring.h"
 #include "utils.h"
 #include "hash_seed.h"
 #include "inifcns.h"
@@ -153,9 +152,7 @@ static const std::string& get_default_TeX_name(const std::string& name);
 std::string symbol::get_name() const
 {
        if (name.empty()) {
-               std::ostringstream s;
-               s << "symbol" << serial;
-               name = s.str();
+               name = "symbol" + std::to_string(serial);
        }
        return name;
 }
diff --git a/ginac/tostring.h b/ginac/tostring.h
deleted file mode 100644 (file)
index 2ab9037..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/** @file tostring.h
- *
- *  Convert object to its string representation (output form). This is an
- *  internal header file. */
-
-/*
- *  GiNaC Copyright (C) 1999-2015 Johannes Gutenberg University Mainz, Germany
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- */
-
-#ifndef GINAC_TOSTRING_H
-#define GINAC_TOSTRING_H
-
-#include <sstream>
-
-namespace GiNaC {
-
-template<class T>
-std::string ToString(const T & t)
-{
-       std::ostringstream buf;
-       buf << t;
-       return buf.str();
-}
-
-} // namespace GiNaC
-
-#endif // ndef GINAC_TOSTRING_H