From 9ed6e2032518e5e39c2491b0b5c916dd5aec4c7e Mon Sep 17 00:00:00 2001 From: Richard Kreckel Date: Tue, 6 Nov 2001 18:55:29 +0000 Subject: [PATCH] * ctor from string: fix for GCC3.0, avoid some string self-assignments. --- ginac/numeric.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/ginac/numeric.cpp b/ginac/numeric.cpp index a368491a..fe51c607 100644 --- a/ginac/numeric.cpp +++ b/ginac/numeric.cpp @@ -168,8 +168,8 @@ numeric::numeric(const char *s) : basic(TINFO_numeric) // We use 'E' as exponent marker in the output, but some people insist on // writing 'e' at input, so let's substitute them right at the beginning: - while ((delim = ss.find('e'))!=std::string::npos) - ss = ss.replace(delim,1,'E'); + while ((delim = ss.find("e"))!=std::string::npos) + ss.replace(delim,1,"E"); // main parser loop: do { @@ -184,12 +184,12 @@ numeric::numeric(const char *s) : basic(TINFO_numeric) if (delim!=std::string::npos) ss = ss.substr(delim); // is the term imaginary? - if (term.find('I')!=std::string::npos) { + if (term.find("I")!=std::string::npos) { // erase 'I': - term = term.replace(term.find('I'),1,""); + term.erase(term.find("I"),1); // erase '*': - if (term.find('*')!=std::string::npos) - term = term.replace(term.find('*'),1,""); + if (term.find("*")!=std::string::npos) + term.erase(term.find("*"),1); // correct for trivial +/-I without explicit factor on I: if (term.size()==1) term += '1'; @@ -206,10 +206,10 @@ numeric::numeric(const char *s) : basic(TINFO_numeric) // 31.4E-1 --> 31.4e-1_ // and s on. // No exponent marker? Let's add a trivial one. - if (term.find('E')==std::string::npos) + if (term.find("E")==std::string::npos) term += "E0"; // E to lower case - term = term.replace(term.find('E'),1,'e'); + term = term.replace(term.find("E"),1,"e"); // append _ to term term += "_" + ToString((unsigned)Digits); // construct float using cln::cl_F(const char *) ctor. -- 2.44.0