hash_map.h
Go to the documentation of this file.
00001 /* hash_map.h
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 #include <cstddef>
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=osl::stl::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 #elif defined __GNUC__
00045     template<class Key, class Value, class HashFun=osl::stl::hash<Key>,
00046              class EqualKey=std::equal_to<Key>,class Alloc=pool_allocator<Value> >
00047     struct hash_map
00048       : public __gnu_cxx::hash_map<Key, Value, HashFun, EqualKey, Alloc>
00049     {
00050       typedef __gnu_cxx::hash_map<Key, Value, HashFun, EqualKey,
00051                                   Alloc> base_t;
00052       hash_map() {}
00053       hash_map(size_t s) : base_t(s)
00054       {
00055       }
00056     };
00057 #else
00058     template<class Key, class Value, class HashFun=osl::stl::hash<Key>,
00059              class EqualKey=std::equal_to<Key>, class Alloc=pool_allocator<std::pair<const Key, Value> > >
00060     struct hash_map
00061       : public boost::unordered_map<Key, Value, HashFun, EqualKey, Alloc>
00062     {
00063       typedef boost::unordered_map<Key, Value, HashFun, EqualKey,
00064                                    Alloc> base_t;
00065       hash_map() {}
00066       hash_map(size_t s) : base_t(s)
00067       {
00068       }
00069       ~hash_map();
00070     };
00071     template<class Key, class Value, class HashFun, class EqualKey, class Alloc>
00072     hash_map<Key,Value,HashFun,EqualKey,Alloc>::~hash_map()
00073     {
00074     }
00075 
00076     template <class T>
00077     struct hash : public boost::hash<T>
00078     {
00079     };
00080 #endif
00081   } // namespace stl
00082   using stl::hash_map;
00083 } // namespace stl
00084 
00085 
00086 #endif /* HASH_MAP_H */
00087 // ;;; Local Variables:
00088 // ;;; mode:c++
00089 // ;;; c-basic-offset:2
00090 // ;;; End:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines