X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=ginac%2Fremember.cpp;h=369ddd0bc68d2eefee32b533db856edbc8d2093f;hp=3a9227304363386503deb7e742c04f3bd5814528;hb=31fef4a6bc14afa46a297b3b87f94204d6c726d5;hpb=4e3a4ac2bcb0837611ea31bc8fc05d84a20c33ac diff --git a/ginac/remember.cpp b/ginac/remember.cpp index 3a922730..369ddd0b 100644 --- a/ginac/remember.cpp +++ b/ginac/remember.cpp @@ -4,7 +4,7 @@ * in GiNaC functions */ /* - * GiNaC Copyright (C) 1999-2001 Johannes Gutenberg University Mainz, Germany + * GiNaC Copyright (C) 1999-2011 Johannes Gutenberg University Mainz, Germany * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,15 +18,15 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include - #include "function.h" #include "utils.h" #include "remember.h" +#include + namespace GiNaC { ////////// @@ -44,7 +44,8 @@ bool remember_table_entry::is_equal(function const & f) const { GINAC_ASSERT(f.seq.size()==seq.size()); if (f.gethash()!=hashvalue) return false; - for (unsigned i=0; iis_equal(f)) { + result = i->get_result(); return true; } + ++i; } return false; } @@ -165,23 +168,23 @@ void remember_table::add_entry(function const & f, ex const & result) operator[](entry).add_entry(f,result); } -void remember_table::clear_all_entries(void) +void remember_table::clear_all_entries() { clear(); init_table(); } -void remember_table::init_table(void) +void remember_table::init_table() { reserve(table_size); for (unsigned i=0; i & remember_table::remember_tables(void) +std::vector & remember_table::remember_tables() { - static std::vector * rt = new std::vector; - return *rt; + static std::vector rt = std::vector(); + return rt; } } // namespace GiNaC