]> www.ginac.de Git - ginac.git/commitdiff
Replace static const variables with constexpr, where applicable.
authorRichard Kreckel <kreckel@ginac.de>
Sun, 8 Nov 2015 22:33:33 +0000 (23:33 +0100)
committerRichard Kreckel <kreckel@ginac.de>
Sun, 8 Nov 2015 22:33:33 +0000 (23:33 +0100)
check/time_antipode.cpp
check/time_lw_M2.cpp
check/time_lw_N.cpp
check/time_lw_O.cpp
check/time_lw_Q.cpp
check/time_lw_Qprime.cpp
ginac/archive.cpp
ginac/inifcns.cpp
ginac/parser/parser_compat.cpp

index 2358db3e05d70b787f1c72f4823c1d24adb315dc..02ebaf1b38fe991dc2b511fa8d552134a448a906 100644 (file)
@@ -46,7 +46,7 @@ using namespace GiNaC;
 using namespace std;
 
 // whether to run this beast or not:
-static const bool do_test = true;
+constexpr bool do_test = true;
 
 // regularization parameter:
 static const symbol x("x");
index 4ba122a2de9535013f19959ad230572ac8e1472c..acd2329c4caf31e5cb6f83de02bdb26ee53677a2 100644 (file)
@@ -28,7 +28,7 @@ using namespace GiNaC;
 #include <iostream>
 using namespace std;
 
-static const bool do_test = false;  // set to true in order to run this beast
+constexpr bool do_test = false;  // set to true in order to run this beast
 
 static unsigned test()
 {
index 1fdb4684f9530bb5e844b68b2fb14a0c432f1e65..c4ad95f98cc1ccc7af28bf794308052fdf106333 100644 (file)
@@ -30,7 +30,7 @@ using namespace GiNaC;
 #include <vector>
 using namespace std;
 
-static const bool do_test = false;  // set to true in order to run this beast
+constexpr bool do_test = false;  // set to true in order to run this beast
 
 static unsigned test()
 {
index 17ab7cb7722a1bb9496a3f6748ad6cc6abefcc1e..715d5019ef66114861287970a063126e26942d0c 100644 (file)
@@ -29,7 +29,7 @@ using namespace GiNaC;
 #include <vector>
 using namespace std;
 
-static const bool do_test2 = false;  // set to true in order to run this beast
+constexpr bool do_test2 = false;  // set to true in order to run this beast
 
 static const symbol a1("a1"), a2("a2"), a3("a3"), a4("a4"), a5("a5"), a6("a6");
 static const symbol b1("b1"), b2("b2"), b3("b3"), b4("b4"), b5("b5"), b6("b6");
index 184a6268e5d0d1727d2325319350deb8979775fb..c109e222b8830acd303b77f95c1f65a863e8922c 100644 (file)
@@ -29,7 +29,7 @@ using namespace GiNaC;
 #include <vector>
 using namespace std;
 
-static const bool do_test = true;  // set to true in order to run this beast
+const bool do_test = true;  // set to true in order to run this beast
 
 static unsigned test()
 {
index 1ab38dd15ed84c7d1fbc95b7de8813354a280e2b..45992a902382f38aa0f96bca19dd2d59fe18fa69 100644 (file)
@@ -29,7 +29,7 @@ using namespace GiNaC;
 #include <vector>
 using namespace std;
 
-static const bool do_test = true;  // set to true in order to run this beast
+const bool do_test = true;  // set to true in order to run this beast
 
 static unsigned test()
 {
index 6a973775005435d5ce3617515f6d4557cfac8ae8..b3eea2bef7c541c34ce30d9376a58a18999f2dfc 100644 (file)
@@ -267,8 +267,8 @@ std::istream &operator>>(std::istream &is, archive &ar)
        is.get(c1); is.get(c2); is.get(c3); is.get(c4);
        if (c1 != 'G' || c2 != 'A' || c3 != 'R' || c4 != 'C')
                throw (std::runtime_error("not a GiNaC archive (signature not found)"));
-       static const unsigned max_version = GINACLIB_ARCHIVE_VERSION;
-       static const unsigned min_version = GINACLIB_ARCHIVE_VERSION - GINACLIB_ARCHIVE_AGE;
+       constexpr unsigned max_version = GINACLIB_ARCHIVE_VERSION;
+       constexpr 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 " + 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)));
index f9305282901194c1a00e158ee778e695df79bf3d..9cb5f676118058067112a5fd18d06d9a060d01f5 100644 (file)
@@ -1218,7 +1218,7 @@ fsolve(const ex& f_in, const symbol& x, const numeric& x1, const numeric& x2)
                        // determined by the secant between the values xx[0] and xx[1].
                        // Don't set the secant_weight to one because that could disturb
                        // the convergence in some corner cases!
-                       static const double secant_weight = 0.984375;  // == 63/64 < 1
+                       constexpr double secant_weight = 0.984375;  // == 63/64 < 1
                        numeric xxmid = (1-secant_weight)*0.5*(xx[0]+xx[1])
                            + secant_weight*(xx[0]+fx[0]*(xx[0]-xx[1])/(fx[1]-fx[0]));
                        ex fxmid_ = f.subs(x == xxmid).evalf();
index 942ec0f76430dc8cad222fef254339d8ce98ebee..3678ea8bfd05618b9941ecf7a1cbb5308a9e6837 100644 (file)
@@ -34,7 +34,7 @@ static symtab make_symtab(const ex& l);
 
 ptr<basic> ex::construct_from_string_and_lst(const std::string &s, const ex &l)
 {
-       static const bool strict = true;
+       constexpr bool strict = true;
        symtab syms = make_symtab(l);
        parser reader(syms, strict); 
        ex parsed_ex = reader(s);