diff options
author | Chris Dyer <cdyer@cs.cmu.edu> | 2011-01-25 22:30:48 +0200 |
---|---|---|
committer | Chris Dyer <cdyer@cs.cmu.edu> | 2011-01-25 22:30:48 +0200 |
commit | c4ade3091b812ca135ae6520fa7173e1bbf28754 (patch) | |
tree | 2528af208f6dafd0c27dcbec0d2da291a9c93ca2 /klm/util/sorted_uniform.hh | |
parent | d04c0ca2d9df0e147239b18e90650ca8bd51d594 (diff) |
update kenlm
Diffstat (limited to 'klm/util/sorted_uniform.hh')
-rw-r--r-- | klm/util/sorted_uniform.hh | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/klm/util/sorted_uniform.hh b/klm/util/sorted_uniform.hh index a8e208fb..05826b51 100644 --- a/klm/util/sorted_uniform.hh +++ b/klm/util/sorted_uniform.hh @@ -62,6 +62,7 @@ template <class PackingT> class SortedUniformMap { public: typedef PackingT Packing; typedef typename Packing::ConstIterator ConstIterator; + typedef typename Packing::MutableIterator MutableIterator; public: // Offer consistent API with probing hash. @@ -113,6 +114,15 @@ template <class PackingT> class SortedUniformMap { *size_ptr_ = (end_ - begin_); } + // Don't use this to change the key. + template <class Key> bool UnsafeMutableFind(const Key key, MutableIterator &out) { +#ifdef DEBUG + assert(initialized_); + assert(loaded_); +#endif + return SortedUniformFind<MutableIterator, Key>(begin_, end_, key, out); + } + // Do not call before FinishedInserting. template <class Key> bool Find(const Key key, ConstIterator &out) const { #ifdef DEBUG |