replacing all boost unordereds

This commit is contained in:
Dennis Luxen
2014-05-09 18:40:07 +02:00
parent 00e27e4b5c
commit 5e26e4c22d
9 changed files with 43 additions and 44 deletions
+18 -19
View File
@@ -28,28 +28,27 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef HASH_TABLE_H
#define HASH_TABLE_H
#include <boost/functional/hash.hpp>
#include <boost/ref.hpp>
#include <boost/unordered_map.hpp>
template<typename Key, typename Value, typename Hash = boost::hash<Key> >
class HashTable : public boost::unordered_map<Key, Value> {
private:
typedef boost::unordered_map<Key, Value, Hash> super;
public:
static Value default_value;
#include <unordered_map>
HashTable() : super() { }
template <typename Key, typename Value> class HashTable : public std::unordered_map<Key, Value>
{
private:
typedef std::unordered_map<Key, Value> super;
explicit HashTable(const unsigned size) : super(size) { }
public:
constexpr static Value default_value();
inline void Add( Key const & key, Value const & value) {
super::emplace(std::make_pair(key, value));
}
HashTable() : super() {}
inline const Value Find(Key const & key) const
explicit HashTable(const unsigned size) : super(size) {}
inline void Add(Key const &key, Value const &value) { super::emplace(key, value); }
inline const Value Find(Key const &key) const
{
typename super::const_iterator iter = super::find(key);
auto iter = super::find(key);
if (iter == super::end())
{
return boost::cref(default_value);
@@ -57,9 +56,9 @@ public:
return boost::cref(iter->second);
}
inline const bool Holds( Key const & key) const
inline const bool Holds(Key const &key) const
{
if(super::find(key) == super::end())
if (super::find(key) == super::end())
{
return false;
}
@@ -67,7 +66,7 @@ public:
}
};
template<typename Key, typename Value, typename Hash>
Value HashTable<Key, Value, Hash>::default_value;
// template<typename Key, typename Value, typename Hash>
// Value HashTable<Key, Value, Hash>::default_value;
#endif /* HASH_TABLE_H */