]> www.ginac.de Git - ginac.git/commitdiff
[C++20] Clean up using-declarations.
authorRichard Kreckel <kreckel@ginac.de>
Mon, 18 May 2020 06:22:21 +0000 (08:22 +0200)
committerRichard Kreckel <kreckel@ginac.de>
Mon, 18 May 2020 06:25:31 +0000 (08:25 +0200)
Never write a using-declaration before #including another header file!

doc/examples/archive1.cpp
doc/examples/compile1.cpp
doc/examples/compile2.cpp
doc/examples/compile3.cpp
doc/examples/mystring.cpp
doc/tutorial/ginac.texi
ginsh/ginsh.h
ginsh/ginsh_lexer.lpp
ginsh/ginsh_parser.ypp

index 6361beccd60fa7d75d140e44b28b12597a1bf8d9..cf55ee5af56820e025a69ff40d57366203bc00d7 100644 (file)
@@ -3,8 +3,9 @@
  */
 
 #include <fstream>
  */
 
 #include <fstream>
-using namespace std;
 #include <ginac/ginac.h>
 #include <ginac/ginac.h>
+
+using namespace std;
 using namespace GiNaC;
 
 int main()
 using namespace GiNaC;
 
 int main()
index c63b9ca022bd2f6bf5dfae75f1c5dc25ef58e376..b92dc766b3bb4501321fbbde208ff08569c31f63 100644 (file)
@@ -1,7 +1,8 @@
 #include <ctime>
 #include <iostream>
 #include <ctime>
 #include <iostream>
-using namespace std;
 #include <ginac/ginac.h>
 #include <ginac/ginac.h>
+
+using namespace std;
 using namespace GiNaC;
 
 /*
 using namespace GiNaC;
 
 /*
index faff99cc9033b6c4379b1aef178d662fe459f921..960bbed9091c8e658a3df297b076bf3175e6c977 100644 (file)
@@ -1,10 +1,11 @@
 #include <iostream>
 #include <iostream>
-using namespace std;
 #include <ginac/ginac.h>
 #include <ginac/ginac.h>
-using namespace GiNaC;
 // Yes, we are using CUBA (should be installed on the system!)
 #include <cuba.h>
 
 // Yes, we are using CUBA (should be installed on the system!)
 #include <cuba.h>
 
+using namespace std;
+using namespace GiNaC;
+
 /*
  * Demonstrates the use of compile_ex with the CUBA library.
  *
 /*
  * Demonstrates the use of compile_ex with the CUBA library.
  *
index 993c3b9ff12aaa369e53376c293b0c228081dca3..b92df53f22c99c610afa5aed3fb72114b45e7efc 100644 (file)
@@ -1,7 +1,8 @@
 #include <ctime>
 #include <iostream>
 #include <ctime>
 #include <iostream>
-using namespace std;
 #include <ginac/ginac.h>
 #include <ginac/ginac.h>
+
+using namespace std;
 using namespace GiNaC;
 
 /*
 using namespace GiNaC;
 
 /*
index 56c844d2cae5401afc801f43edb7807d1585db20..640f81eba84478e5a3d8a5b91d81edcf75a6b670 100644 (file)
@@ -4,9 +4,10 @@
 #include <iostream>
 #include <string>   
 #include <stdexcept>
 #include <iostream>
 #include <string>   
 #include <stdexcept>
-using namespace std;
 
 #include <ginac/ginac.h>
 
 #include <ginac/ginac.h>
+
+using namespace std;
 using namespace GiNaC;
 
 class mystring : public basic
 using namespace GiNaC;
 
 class mystring : public basic
index 765c966e69462edb3934f7230b2e1f3a4a13b154..1ba42151e86a39898c9c2dbef89cc4268c1d5a3f 100644 (file)
@@ -6696,8 +6696,8 @@ expression a unique name:
 
 @example
 #include <fstream>
 
 @example
 #include <fstream>
-using namespace std;
 #include <ginac/ginac.h>
 #include <ginac/ginac.h>
+using namespace std;
 using namespace GiNaC;
 
 int main()
 using namespace GiNaC;
 
 int main()
@@ -7613,9 +7613,8 @@ product in a C++ @code{struct}:
 
 @example
 #include <iostream>
 
 @example
 #include <iostream>
-using namespace std;
-
 #include <ginac/ginac.h>
 #include <ginac/ginac.h>
+using namespace std;
 using namespace GiNaC;
 
 struct sprod_s @{
 using namespace GiNaC;
 
 struct sprod_s @{
@@ -8007,9 +8006,8 @@ as follows:
 #include <iostream>
 #include <string>   
 #include <stdexcept>
 #include <iostream>
 #include <string>   
 #include <stdexcept>
-using namespace std;
-
 #include <ginac/ginac.h>
 #include <ginac/ginac.h>
+using namespace std;
 using namespace GiNaC;
 @end example
 
 using namespace GiNaC;
 @end example
 
index ffaf4e0da1b6d87f62415ec186f528ba461dbced..973c6f0d9fb73bd1491025a6d50b2a506a11931e 100644 (file)
@@ -29,8 +29,6 @@
 #include <iostream>
 #include <string>
 
 #include <iostream>
 #include <string>
 
-using namespace std;
-
 #ifdef HAVE_READLINE_READLINE_H
 extern "C" {
 #include <readline/readline.h>
 #ifdef HAVE_READLINE_READLINE_H
 extern "C" {
 #include <readline/readline.h>
@@ -49,10 +47,8 @@ extern "C" {
 #include <ginac/ginac.h>
 #endif
 
 #include <ginac/ginac.h>
 #endif
 
-using namespace GiNaC;
-
 // yacc stack type
 // yacc stack type
-#define YYSTYPE ex
+#define YYSTYPE GiNaC::ex
 
 // lex functions/variables
 extern int yyerror(const char *s);
 
 // lex functions/variables
 extern int yyerror(const char *s);
@@ -65,7 +61,7 @@ extern int num_files;
 extern char **file_list;
 
 // Table of all used symbols
 extern char **file_list;
 
 // Table of all used symbols
-typedef map<string, ex> sym_tab;
+typedef std::map<std::string, GiNaC::ex> sym_tab;
 extern sym_tab syms;
 
 // Type of symbols to generate (real or complex)
 extern sym_tab syms;
 
 // Type of symbols to generate (real or complex)
index bc008b4edc6e15b78abbb3958cf97f53b8f1426e..4218193e1a563630a05fb616cfa3ccf0ed596910 100644 (file)
@@ -38,6 +38,9 @@
 #include "ginsh.h"
 #include "ginsh_parser.hpp"
 
 #include "ginsh.h"
 #include "ginsh_parser.hpp"
 
+using namespace std;
+using namespace GiNaC;
+
 #define YY_INPUT(buf, result, max_size) (result = ginsh_input(buf, max_size))
 
 // Table of all used symbols
 #define YY_INPUT(buf, result, max_size) (result = ginsh_input(buf, max_size))
 
 // Table of all used symbols
index a18229e37f3cf10841eeb335ac645e37c8e10b56..c76616d0b9026c8e38c84607966601c02de35166 100644 (file)
@@ -45,6 +45,9 @@
 
 #include "ginsh.h"
 
 
 #include "ginsh.h"
 
+using namespace std;
+using namespace GiNaC;
+
 #define YYERROR_VERBOSE 1
 
 #ifdef HAVE_LIBREADLINE
 #define YYERROR_VERBOSE 1
 
 #ifdef HAVE_LIBREADLINE