diff options
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 |