From: Richard Kreckel Date: Sat, 7 Nov 2015 21:24:29 +0000 (+0100) Subject: Use C++11 'nullptr' where applicable. X-Git-Tag: release_1-7-0~7^2~59 X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=commitdiff_plain;h=ff4d880932862000fce73efc3fb6da49c8d63ed6 Use C++11 'nullptr' where applicable. --- diff --git a/ginac/basic.h b/ginac/basic.h index ff799ffe..f11db911 100644 --- a/ginac/basic.h +++ b/ginac/basic.h @@ -310,7 +310,7 @@ extern int max_recursion_level; template inline bool is_a(const basic &obj) { - return dynamic_cast(&obj) != 0; + return dynamic_cast(&obj) != nullptr; } /** Check if obj is a T, not including base classes. */ diff --git a/ginac/constant.cpp b/ginac/constant.cpp index 3fb3460a..cf6c4ae1 100644 --- a/ginac/constant.cpp +++ b/ginac/constant.cpp @@ -45,7 +45,7 @@ GINAC_IMPLEMENT_REGISTERED_CLASS_OPT(constant, basic, // public -constant::constant() : ef(0), serial(next_serial++), domain(domain::complex) +constant::constant() : ef(nullptr), serial(next_serial++), domain(domain::complex) { setflag(status_flags::evaluated | status_flags::expanded); } @@ -67,7 +67,7 @@ constant::constant(const std::string & initname, evalffunctype efun, const std:: } constant::constant(const std::string & initname, const numeric & initnumber, const std::string & texname, unsigned dm) - : name(initname), ef(0), number(initnumber), serial(next_serial++), domain(dm) + : name(initname), ef(nullptr), number(initnumber), serial(next_serial++), domain(dm) { if (texname.empty()) TeX_name = "\\mathrm{" + name + "}"; @@ -150,7 +150,7 @@ bool constant::info(unsigned inf) const ex constant::evalf(int level) const { - if (ef!=0) { + if (ef!=nullptr) { return ef(); } else { return number.evalf(); diff --git a/ginac/constant.h b/ginac/constant.h index 8c79460f..f75a629f 100644 --- a/ginac/constant.h +++ b/ginac/constant.h @@ -42,7 +42,7 @@ class constant : public basic GINAC_DECLARE_REGISTERED_CLASS(constant, basic) // other constructors public: - constant(const std::string & initname, evalffunctype efun = 0, const std::string & texname = std::string(), unsigned domain = domain::complex); + constant(const std::string & initname, evalffunctype efun = nullptr, const std::string & texname = std::string(), unsigned domain = domain::complex); constant(const std::string & initname, const numeric & initnumber, const std::string & texname = std::string(), unsigned domain = domain::complex); // functions overriding virtual functions from base classes diff --git a/ginac/function.cppy b/ginac/function.cppy index fb1d8791..f04b21b7 100644 --- a/ginac/function.cppy +++ b/ginac/function.cppy @@ -79,7 +79,7 @@ void function_options::initialize() set_name("unnamed_function", "\\\\mbox{unnamed}"); nparams = 0; eval_f = evalf_f = real_part_f = imag_part_f = conjugate_f = expand_f - = derivative_f = expl_derivative_f = power_f = series_f = 0; + = derivative_f = expl_derivative_f = power_f = series_f = nullptr; info_f = 0; evalf_params_first = true; use_return_type = false; @@ -386,7 +386,7 @@ ex function::eval(int level) const } } - if (opt.eval_f==0) { + if (opt.eval_f==nullptr) { return this->hold(); } diff --git a/ginac/function.hppy b/ginac/function.hppy index b7d7b0d1..2d388261 100644 --- a/ginac/function.hppy +++ b/ginac/function.hppy @@ -134,7 +134,7 @@ public: return *this; } - function_options & set_return_type(unsigned rt, const return_type_t* rtt = 0); + function_options & set_return_type(unsigned rt, const return_type_t* rtt = nullptr); function_options & do_not_evalf_params(); function_options & remember(unsigned size, unsigned assoc_size=0, unsigned strategy=remember_strategies::delete_never); diff --git a/ginac/operators.cpp b/ginac/operators.cpp index 52a84641..31527411 100644 --- a/ginac/operators.cpp +++ b/ginac/operators.cpp @@ -334,7 +334,7 @@ static inline unsigned get_print_options(std::ios_base & s) static void set_print_options(std::ostream & s, unsigned options) { print_context *p = get_print_context(s); - if (p == 0) + if (p == nullptr) set_print_context(s, print_dflt(s, options)); else p->options = options; @@ -343,7 +343,7 @@ static void set_print_options(std::ostream & s, unsigned options) std::ostream & operator<<(std::ostream & os, const ex & e) { print_context *p = get_print_context(os); - if (p == 0) + if (p == nullptr) e.print(print_dflt(os)); else e.print(*p); @@ -363,7 +363,7 @@ std::ostream & operator<<(std::ostream & os, const exvector & e) os << "["; while (true) { - if (p == 0) + if (p == nullptr) i -> print(print_dflt(os)); else i -> print(*p); @@ -390,7 +390,7 @@ std::ostream & operator<<(std::ostream & os, const exset & e) os << "<"; while (true) { - if (p == 0) + if (p == nullptr) i->print(print_dflt(os)); else i->print(*p); @@ -417,12 +417,12 @@ std::ostream & operator<<(std::ostream & os, const exmap & e) os << "{"; while (true) { - if (p == 0) + if (p == nullptr) i->first.print(print_dflt(os)); else i->first.print(*p); os << "=="; - if (p == 0) + if (p == nullptr) i->second.print(print_dflt(os)); else i->second.print(*p); diff --git a/ginac/polynomial/normalize.h b/ginac/polynomial/normalize.h index 280e5983..e33963f6 100644 --- a/ginac/polynomial/normalize.h +++ b/ginac/polynomial/normalize.h @@ -29,14 +29,14 @@ namespace GiNaC { -bool normalize_in_field(umodpoly& a, cln::cl_MI* content_ = 0); +bool normalize_in_field(umodpoly& a, cln::cl_MI* content_ = nullptr); /// Make the univariate polynomial @a x unit normal. This version is used /// for rings which are not fields. /// Returns true if the polynomial @x is already unit normal, and false /// otherwise. template bool -normalize_in_ring(T& x, typename T::value_type* content_ = 0, int* unit_ = 0) +normalize_in_ring(T& x, typename T::value_type* content_ = nullptr, int* unit_ = nullptr) { typedef typename T::value_type ring_t; static const ring_t one(1); diff --git a/ginac/print.h b/ginac/print.h index 47050dde..34456cd7 100644 --- a/ginac/print.h +++ b/ginac/print.h @@ -179,7 +179,7 @@ public: /** Check if obj is a T, including base classes. */ template inline bool is_a(const print_context & obj) -{ return dynamic_cast(&obj) != 0; } +{ return dynamic_cast(&obj) != nullptr; } class basic; @@ -252,7 +252,7 @@ public: { if (this != &other) { print_functor_impl *p = other.impl.get(); - impl.reset(p ? other.impl->duplicate() : 0); + impl.reset(p ? other.impl->duplicate() : nullptr); } return *this; }