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 #else
00011 #  include <boost/unordered_map.hpp>
00012 #endif
00013 #include <cstddef>
00014 namespace osl
00015 {
00016   namespace stl
00017   {
00018     template <class T>
00019     struct hash;
00020   
00021 #if (__GNUC__ >= 4 && __GNUC_MINOR__ >=3)
00022     template<class Key, class Value, class HashFun=osl::stl::hash<Key>,
00023              class EqualKey=std::equal_to<Key>,
00024              class Alloc=pool_allocator<std::pair<const Key, Value> > >
00025     struct hash_map
00026       : public std::tr1::unordered_map<Key, Value, HashFun, EqualKey,
00027                                        Alloc>
00028     {
00029       typedef std::tr1::unordered_map<Key, Value, HashFun, EqualKey,
00030                                       Alloc> base_t;
00031       hash_map() {}
00032       hash_map(size_t s) : base_t(s)
00033       {
00034       }
00035       ~hash_map();
00036     };
00037     template<class Key, class Value, class HashFun, class EqualKey, class Alloc>
00038     hash_map<Key,Value,HashFun,EqualKey,Alloc>::~hash_map()
00039     {
00040     }
00041 
00042 #else
00043     template<class Key, class Value, class HashFun=osl::stl::hash<Key>,
00044              class EqualKey=std::equal_to<Key>, class Alloc=pool_allocator<std::pair<const Key, Value> > >
00045     struct hash_map
00046       : public boost::unordered_map<Key, Value, HashFun, EqualKey, Alloc>
00047     {
00048       typedef boost::unordered_map<Key, Value, HashFun, EqualKey,
00049                                    Alloc> base_t;
00050       hash_map() {}
00051       hash_map(size_t s) : base_t(s)
00052       {
00053       }
00054       ~hash_map();
00055     };
00056     template<class Key, class Value, class HashFun, class EqualKey, class Alloc>
00057     hash_map<Key,Value,HashFun,EqualKey,Alloc>::~hash_map()
00058     {
00059     }
00060 #endif
00061   } // namespace stl
00062   using stl::hash_map;
00063 } // namespace stl
00064 
00065 
00066 #endif /* HASH_MAP_H */
00067 // ;;; Local Variables:
00068 // ;;; mode:c++
00069 // ;;; c-basic-offset:2
00070 // ;;; End:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines