diff options
author | graehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f> | 2010-08-11 03:12:09 +0000 |
---|---|---|
committer | graehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f> | 2010-08-11 03:12:09 +0000 |
commit | fd2fcc1ba58dcd385390b9cb0123868e4c59416e (patch) | |
tree | fe3253861cd7e8f66d961a62f93f9d02d51a4450 /utils/hash.h | |
parent | 61e303bf40bf00f04e2c0d148fb6792b23987332 (diff) |
get_default mapped_type
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@518 ec762483-ff6d-05da-a07a-a48fb63a330f
Diffstat (limited to 'utils/hash.h')
-rwxr-xr-x | utils/hash.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/utils/hash.h b/utils/hash.h index c241d139..e89b1863 100755 --- a/utils/hash.h +++ b/utils/hash.h @@ -51,10 +51,11 @@ struct murmur_hash_array } }; + // adds default val to table if key wasn't found, returns ref to val template <class H,class K> typename H::mapped_type & get_default(H &ht,K const& k,typename H::mapped_type const& v) { - return const_cast<typename H::data_type &>(ht.insert(typename H::value_type(k,v)).first->second); + return const_cast<typename H::mapped_type &>(ht.insert(typename H::value_type(k,v)).first->second); } #endif |