From dd4f73f73c226e666596c93a100259b1d0baab33 Mon Sep 17 00:00:00 2001 From: Christian Bauer Date: Thu, 17 Jul 2003 20:19:57 +0000 Subject: [PATCH] some (trivial) fixes for gcc 3.4 --- check/exam_inifcns.cpp | 4 ++++ check/exam_pseries.cpp | 8 ++++++++ check/time_antipode.cpp | 4 ++-- ginac/basic.h | 29 ----------------------------- ginac/ex.h | 30 ++++++++++++++++++++++++++++++ ginac/function.pl | 4 ++-- 6 files changed, 46 insertions(+), 33 deletions(-) diff --git a/check/exam_inifcns.cpp b/check/exam_inifcns.cpp index 1291030a..c222eddf 100644 --- a/check/exam_inifcns.cpp +++ b/check/exam_inifcns.cpp @@ -26,6 +26,8 @@ /* Assorted tests on other transcendental functions. */ static unsigned inifcns_consist_trans(void) { + using GiNaC::asin; using GiNaC::acos; + unsigned result = 0; symbol x("x"); ex chk; @@ -163,6 +165,8 @@ static unsigned inifcns_consist_gamma(void) arguments where the result exists in closed form and check if it's ok. */ static unsigned inifcns_consist_psi(void) { + using GiNaC::log; + unsigned result = 0; symbol x; ex e, f; diff --git a/check/exam_pseries.cpp b/check/exam_pseries.cpp index a5d9c4fd..87cea8e9 100644 --- a/check/exam_pseries.cpp +++ b/check/exam_pseries.cpp @@ -41,6 +41,8 @@ static unsigned check_series(const ex &e, const ex &point, const ex &d, int orde // Series expansion static unsigned exam_series1(void) { + using GiNaC::log; + unsigned result = 0; ex e, d; @@ -233,6 +235,8 @@ static unsigned exam_series9(void) // Series expansion of Li2((x==2)^2), caring about branch-cut static unsigned exam_series10(void) { + using GiNaC::log; + ex e = Li2(pow(x,2)); ex d = Li2(4) + (-log(3) + I*Pi*csgn(I-I*pow(x,2))) * (x-2) + (numeric(-2,3) + log(3)/4 - I*Pi/4*csgn(I-I*pow(x,2))) * pow(x-2,2) @@ -245,6 +249,8 @@ static unsigned exam_series10(void) // Series expansion of logarithms around branch points static unsigned exam_series11(void) { + using GiNaC::log; + unsigned result = 0; ex e, d; symbol a("a"); @@ -285,6 +291,8 @@ static unsigned exam_series11(void) // Series expansion of other functions around branch points static unsigned exam_series12(void) { + using GiNaC::log; + unsigned result = 0; ex e, d; diff --git a/check/time_antipode.cpp b/check/time_antipode.cpp index 09870db8..30aaacbc 100644 --- a/check/time_antipode.cpp +++ b/check/time_antipode.cpp @@ -442,9 +442,9 @@ static const node tree6(unsigned cuts=0) bool(cuts & 16))); } -static unsigned test_tree(const node (*tree_generator)(unsigned=0)) +static unsigned test_tree(const node tree_generator(unsigned)) { - const int edges = tree_generator().total_edges(); + const int edges = tree_generator(0).total_edges(); const int vertices = edges+1; // fill a vector of all possible 2^edges combinations of cuts... diff --git a/ginac/basic.h b/ginac/basic.h index c68234f3..264462f9 100644 --- a/ginac/basic.h +++ b/ginac/basic.h @@ -188,35 +188,6 @@ inline bool is_exactly_a(const class basic &obj) const T foo; return foo.tinfo()==obj.tinfo(); } -/** Check if ex is a handle to a T, including base classes. */ -template -inline bool is_a(const ex &obj) -{ - return is_a(*obj.bp); -} - -/** Check if ex is a handle to a T, not including base classes. */ -template -inline bool is_exactly_a(const ex &obj) -{ - return is_exactly_a(*obj.bp); -} - -/** Return a reference to the basic-derived class T object embedded in an - * expression. This is fast but unsafe: the result is undefined if the - * expression does not contain a T object at its top level. Hence, you - * should generally check the type of e first. - * - * @param e expression - * @return reference to pseries object - * @see is_exactly_a() */ -template -inline const T &ex_to(const ex &e) -{ - GINAC_ASSERT(is_a(e)); - return static_cast(*e.bp); -} - } // namespace GiNaC #endif // ndef __GINAC_BASIC_H__ diff --git a/ginac/ex.h b/ginac/ex.h index 3c8094b1..4f1074d9 100644 --- a/ginac/ex.h +++ b/ginac/ex.h @@ -546,6 +546,36 @@ inline ex ex::map(ex (*f)(const ex & e)) const return bp->map(fcn); } +// convenience type checker template functions + +/** Check if ex is a handle to a T, including base classes. */ +template +inline bool is_a(const ex &obj) +{ + return is_a(*obj.bp); +} + +/** Check if ex is a handle to a T, not including base classes. */ +template +inline bool is_exactly_a(const ex &obj) +{ + return is_exactly_a(*obj.bp); +} + +/** Return a reference to the basic-derived class T object embedded in an + * expression. This is fast but unsafe: the result is undefined if the + * expression does not contain a T object at its top level. Hence, you + * should generally check the type of e first. + * + * @param e expression + * @return reference to object of class T + * @see is_exactly_a() */ +template +inline const T &ex_to(const ex &e) +{ + GINAC_ASSERT(is_a(e)); + return static_cast(*e.bp); +} } // namespace GiNaC diff --git a/ginac/function.pl b/ginac/function.pl index 78deea4b..d3378e33 100755 --- a/ginac/function.pl +++ b/ginac/function.pl @@ -1004,12 +1004,12 @@ std::vector & function::registered_functions(void) bool function::lookup_remember_table(ex & result) const { - return remember_table::remember_tables()[serial].lookup_entry(*this,result); + return remember_table::remember_tables()[this->serial].lookup_entry(*this,result); } void function::store_remember_table(ex const & result) const { - remember_table::remember_tables()[serial].add_entry(*this,result); + remember_table::remember_tables()[this->serial].add_entry(*this,result); } // public -- 2.49.0