From c987c2f0f7c08e6751f4bd0d004f6df8e6a225a3 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Mon, 10 Dec 2007 05:16:08 +0000 Subject: [PATCH] added new ktrie function for running custom destructor --HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401786 --- public/sm_trie_tpl.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/public/sm_trie_tpl.h b/public/sm_trie_tpl.h index 195e1988..5d9b0b59 100644 --- a/public/sm_trie_tpl.h +++ b/public/sm_trie_tpl.h @@ -659,6 +659,17 @@ public: free(m_base); free(m_stringtab); } + void run_destructor(void (*dtor)(K * ptr)) + { + for (size_t i = 0; i <= m_baseSize; i++) + { + if (m_base[i].valset) + { + dtor(&m_base[i].value); + m_base[i].valset = false; + } + } + } private: class KTrieNode {