]> www.ginac.de Git - ginac.git/commitdiff
Use C++11 'nullptr' where applicable.
authorRichard Kreckel <kreckel@ginac.de>
Sat, 7 Nov 2015 21:24:29 +0000 (22:24 +0100)
committerRichard Kreckel <kreckel@ginac.de>
Sat, 7 Nov 2015 21:24:29 +0000 (22:24 +0100)
ginac/basic.h
ginac/constant.cpp
ginac/constant.h
ginac/function.cppy
ginac/function.hppy
ginac/operators.cpp
ginac/polynomial/normalize.h
ginac/print.h

index ff799ffe8bb828616bdc9bb9db48081b27a4fd35..f11db911aee78ff3cf193819be6771db3b521abc 100644 (file)
@@ -310,7 +310,7 @@ extern int max_recursion_level;
 template <class T>
 inline bool is_a(const basic &obj)
 {
-       return dynamic_cast<const T *>(&obj) != 0;
+       return dynamic_cast<const T *>(&obj) != nullptr;
 }
 
 /** Check if obj is a T, not including base classes. */
index 3fb3460a3ac3cc6d1db0e3d817402904fec09714..cf6c4ae1207e1ff0fc843a03aa7c13a7bbbc60eb 100644 (file)
@@ -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();
index 8c79460f0ebab3cec1102a1d130a37c818cd7ada..f75a629f27d27ee3ce3c6e36418caf308f424e75 100644 (file)
@@ -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
index fb1d879192a4b0e1a42712f4776d5a730b1b0ca4..f04b21b743cb447505dfbd877e2999755bc7e2c5 100644 (file)
@@ -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();
        }
 
index b7d7b0d1c1715b91871d4ec7ceaba78e8af86bd9..2d3882616aab6ccdf28ad36f3f7adf4e85a57305 100644 (file)
@@ -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);
index 52a84641ef773d7b3f9b99092b1415fe1a010239..31527411645c8c30f0b5718fd271e6cdf15bbd14 100644 (file)
@@ -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);
index 280e598302bef97e7c71058d5e5669df34ee5b45..e33963f6f2f51f3c4b38adfd8aa7dd976c414f3e 100644 (file)
 
 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<typename T> 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);
index 47050dde90a75ddb4a687c552eb4bbf7ff0d67eb..34456cd724b1b22bdd198b512dec8fcabd45aee3 100644 (file)
@@ -179,7 +179,7 @@ public:
 /** Check if obj is a T, including base classes. */
 template <class T>
 inline bool is_a(const print_context & obj)
-{ return dynamic_cast<const T *>(&obj) != 0; }
+{ return dynamic_cast<const T *>(&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;
        }