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");
#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()
{
#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()
{
#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");
#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()
{
#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()
{
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)));
// 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();
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);