removing boost cref and betting on move semantics
This commit is contained in:
parent
5e26e4c22d
commit
985a8e9f97
@ -28,8 +28,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#ifndef HASH_TABLE_H
|
#ifndef HASH_TABLE_H
|
||||||
#define HASH_TABLE_H
|
#define HASH_TABLE_H
|
||||||
|
|
||||||
#include <boost/ref.hpp>
|
|
||||||
|
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|
||||||
template <typename Key, typename Value> class HashTable : public std::unordered_map<Key, Value>
|
template <typename Key, typename Value> class HashTable : public std::unordered_map<Key, Value>
|
||||||
@ -38,8 +36,6 @@ template <typename Key, typename Value> class HashTable : public std::unordered_
|
|||||||
typedef std::unordered_map<Key, Value> super;
|
typedef std::unordered_map<Key, Value> super;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
constexpr static Value default_value();
|
|
||||||
|
|
||||||
HashTable() : super() {}
|
HashTable() : super() {}
|
||||||
|
|
||||||
explicit HashTable(const unsigned size) : super(size) {}
|
explicit HashTable(const unsigned size) : super(size) {}
|
||||||
@ -51,9 +47,9 @@ template <typename Key, typename Value> class HashTable : public std::unordered_
|
|||||||
auto iter = super::find(key);
|
auto iter = super::find(key);
|
||||||
if (iter == super::end())
|
if (iter == super::end())
|
||||||
{
|
{
|
||||||
return boost::cref(default_value);
|
return Value();
|
||||||
}
|
}
|
||||||
return boost::cref(iter->second);
|
return iter->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const bool Holds(Key const &key) const
|
inline const bool Holds(Key const &key) const
|
||||||
@ -66,7 +62,4 @@ template <typename Key, typename Value> class HashTable : public std::unordered_
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// template<typename Key, typename Value, typename Hash>
|
|
||||||
// Value HashTable<Key, Value, Hash>::default_value;
|
|
||||||
|
|
||||||
#endif /* HASH_TABLE_H */
|
#endif /* HASH_TABLE_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user