X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=ginac%2Fhash_map.h;h=5e9895ae387dd9861cbe34905cc123b7c5f32fa2;hp=839b8238f8402c78ded1c0c4dea3bce19e278d0a;hb=4ec372a00b1a13e6374ce880cbd68c2e14114dad;hpb=5e1d38fb7294baa1922341021698a2106238b571 diff --git a/ginac/hash_map.h b/ginac/hash_map.h index 839b8238..5e9895ae 100644 --- a/ginac/hash_map.h +++ b/ginac/hash_map.h @@ -3,7 +3,7 @@ * Replacement for map<> using hash tables. */ /* - * GiNaC Copyright (C) 1999-2003 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 @@ -17,19 +17,18 @@ * * 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 */ -#ifndef __GINAC_HASH_MAP_H__ -#define __GINAC_HASH_MAP_H__ +#ifndef GINAC_HASH_MAP_H +#define GINAC_HASH_MAP_H -#include -#include #include #include +#include +#include #include - namespace GiNaC { /* @@ -73,7 +72,6 @@ class exhashmap; * * Differences to map<>: * - no lower_bound()/upper_bound() - * - no "insert with a hint" insert(iterator, key_type) * - no reverse iterators, no rbegin()/rend() * - no operator<() * - comparison functor is hardcoded to ex_is_less @@ -254,13 +252,6 @@ protected: return num_buckets - (num_buckets >> 2); } - /** Empty all buckets in the table. */ - void empty_all_buckets() - { - for (table_iterator i = hashtab.begin(); i != hashtab.end(); ++i) - i->first = EMPTY; - } - void grow(); public: @@ -343,6 +334,11 @@ public: // Modifiers std::pair insert(const value_type &x); + iterator insert(iterator pos, const value_type &x) + { + return insert(x).first; + } + template void insert(InputIterator first, InputIterator last) { @@ -434,6 +430,7 @@ public: return !(lhs == rhs); } +#if 0 void dump() const { std::clog << "num_entries = " << num_entries << std::endl; @@ -444,6 +441,7 @@ public: std::clog << (it->first == EMPTY ? "free" : (it->first == USED ? "used" : "erased")) << ", " << it->second.first << " -> " << it->second.second << std::endl; } } +#endif }; /** Return pointer to bucket corresponding to key (or first empty bucket). */ @@ -595,4 +593,4 @@ inline void swap(GiNaC::exhashmap &lhs, GiNaC::exhashmap &rhs) } // namespace std -#endif // ndef __GINAC_HASH_MAP_H__ +#endif // ndef GINAC_HASH_MAP_H