00001
00002
00003 #ifndef HASH_MAP_H
00004 #define HASH_MAP_H
00005
00006 #include "osl/stl/hash.h"
00007 #include "osl/stl/pool_allocator.h"
00008 #if (__GNUC__ >= 4 && __GNUC_MINOR__ >=3)
00009 # include <tr1/unordered_map>
00010 #elif __GNUC__
00011 # include <ext/hash_map>
00012 #else
00013 # include <boost/unordered_map.hpp>
00014 #endif
00015
00016 namespace osl
00017 {
00018 namespace stl
00019 {
00020 template <class T>
00021 struct hash;
00022
00023 #if (__GNUC__ >= 4 && __GNUC_MINOR__ >=3)
00024 template<class Key, class Value, class HashFun=hash<Key>,
00025 class EqualKey=std::equal_to<Key>,
00026 class Alloc=pool_allocator<std::pair<const Key, Value> > >
00027 struct hash_map
00028 : public std::tr1::unordered_map<Key, Value, HashFun, EqualKey,
00029 Alloc>
00030 {
00031 typedef std::tr1::unordered_map<Key, Value, HashFun, EqualKey,
00032 Alloc> base_t;
00033 hash_map() {}
00034 hash_map(size_t s) : base_t(s)
00035 {
00036 }
00037 ~hash_map();
00038 };
00039 template<class Key, class Value, class HashFun, class EqualKey, class Alloc>
00040 hash_map<Key,Value,HashFun,EqualKey,Alloc>::~hash_map()
00041 {
00042 }
00043
00044 template <class T>
00045 struct hash : public std::tr1::hash<T>
00046 {
00047 };
00048 #elif defined __GNUC__
00049 template<class Key, class Value, class HashFun=osl::stl::hash<Key>,
00050 class EqualKey=std::equal_to<Key>,class Alloc=pool_allocator<Value> >
00051 struct hash_map
00052 : public __gnu_cxx::hash_map<Key, Value, HashFun, EqualKey, Alloc>
00053 {
00054 typedef __gnu_cxx::hash_map<Key, Value, HashFun, EqualKey,
00055 Alloc> base_t;
00056 hash_map() {}
00057 hash_map(size_t s) : base_t(s)
00058 {
00059 }
00060 };
00061 #else
00062 template<class Key, class Value, class HashFun=osl::stl::hash<Key>,
00063 class EqualKey=std::equal_to<Key>, class Alloc=pool_allocator<std::pair<const Key, Value> > >
00064 struct hash_map
00065 : public boost::unordered_map<Key, Value, HashFun, EqualKey, Alloc>
00066 {
00067 typedef boost::unordered_map<Key, Value, HashFun, EqualKey,
00068 Alloc> base_t;
00069 hash_map() {}
00070 hash_map(size_t s) : base_t(s)
00071 {
00072 }
00073 ~hash_map();
00074 };
00075 template<class Key, class Value, class HashFun, class EqualKey, class Alloc>
00076 hash_map<Key,Value,HashFun,EqualKey,Alloc>::~hash_map()
00077 {
00078 }
00079
00080 template <class T>
00081 struct hash : public boost::hash<T>
00082 {
00083 };
00084 #endif
00085 }
00086 using stl::hash_map;
00087 }
00088
00089
00090 #endif
00091
00092
00093
00094