From 31ff7ecb412ee470d0464bb210a0e9adabed065a Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 26 Nov 2006 01:57:09 +0000 Subject: update to lcdf-typetools 2.46 git-svn-id: svn://tug.org/texlive/trunk@2536 c570f23f-e606-0410-a88d-b1316a301751 --- .../utils/lcdf-typetools/include/lcdf/hashmap.hh | 58 ++++++++++++---------- 1 file changed, 33 insertions(+), 25 deletions(-) (limited to 'Build/source/utils/lcdf-typetools/include/lcdf/hashmap.hh') diff --git a/Build/source/utils/lcdf-typetools/include/lcdf/hashmap.hh b/Build/source/utils/lcdf-typetools/include/lcdf/hashmap.hh index c1f1339b976..10b5c321177 100644 --- a/Build/source/utils/lcdf-typetools/include/lcdf/hashmap.hh +++ b/Build/source/utils/lcdf-typetools/include/lcdf/hashmap.hh @@ -19,6 +19,30 @@ template class _HashMap_const_iterator; template class _HashMap_iterator; +inline unsigned +hashcode(int i) +{ + return static_cast(i); +} + +inline unsigned +hashcode(unsigned u) +{ + return u; +} + +inline unsigned +hashcode(long l) +{ + return static_cast(l); +} + +inline unsigned +hashcode(unsigned long ul) +{ + return static_cast(ul); +} + template class HashMap { public: @@ -43,7 +67,8 @@ class HashMap { public: inline const V &find(const K &) const; inline V *findp(const K &) const; inline const V &operator[](const K &k) const; - V &find_force(const K &); + V &find_force(const K &, const V &); + inline V &find_force(const K &); bool insert(const K &, const V &); void clear(); @@ -153,6 +178,13 @@ HashMap::findp(const K &key) const return _e[i].key ? &_e[i].value : 0; } +template +inline V & +HashMap::find_force(const K &key) +{ + return find_force(key, _default_value); +} + template inline _HashMap_const_iterator HashMap::begin() const @@ -195,29 +227,5 @@ _HashMap_const_iterator::operator!=(const const_iterator &i) const return _hm != i._hm || _pos != i._pos; } -inline unsigned -hashcode(int i) -{ - return static_cast(i); -} - -inline unsigned -hashcode(unsigned u) -{ - return u; -} - -inline unsigned -hashcode(long l) -{ - return static_cast(l); -} - -inline unsigned -hashcode(unsigned long ul) -{ - return static_cast(ul); -} - #include // necessary to support GCC 3.3 #endif -- cgit v1.2.3