From c752987457f50c1adf5051e1fd8167a5637f1e34 Mon Sep 17 00:00:00 2001 From: Thomas Grill Date: Tue, 26 Oct 2004 20:03:50 +0000 Subject: "" svn path=/trunk/; revision=2169 --- externals/grill/flext/source/flmap.h | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'externals/grill/flext/source/flmap.h') diff --git a/externals/grill/flext/source/flmap.h b/externals/grill/flext/source/flmap.h index c20b5ade..64d4f565 100644 --- a/externals/grill/flext/source/flmap.h +++ b/externals/grill/flext/source/flmap.h @@ -21,18 +21,21 @@ WARRANTIES, see the file, "license.txt," in this distribution. @{ */ +//! Key/Value type for AnyMap... must have size of pointer! +typedef size_t AnyMapType; + //! Base class for maps class AnyMap: - public std::map + public std::map { - typedef std::map Parent; + typedef std::map Parent; public: AnyMap(); ~AnyMap(); - iterator find(unsigned int k); - unsigned int &operator [](unsigned int k); + iterator find(AnyMapType k); + AnyMapType &operator [](AnyMapType k); - typedef std::pair pair; + typedef std::pair pair; }; //! Specialized map class for any 32-bit key/value types @@ -66,9 +69,9 @@ public: inline T &data() const { return *(T *)&second; } }; - inline iterator find(K k) { return AnyMap::find(*(unsigned int *)&k); } - inline T &operator [](K k) { return *(T *)&(AnyMap::operator [](*(unsigned int *)&k)); } - inline void erase(K k) { AnyMap::erase(*(unsigned int *)&k); } + inline iterator find(K k) { return AnyMap::find(*(AnyMapType *)&k); } + inline T &operator [](K k) { return *(T *)&(AnyMap::operator [](*(AnyMapType *)&k)); } + inline void erase(K k) { AnyMap::erase(*(AnyMapType *)&k); } }; //! @} // FLEXT_SUPPORT -- cgit v1.2.1