diff --git a/lmdb-typed.hh b/lmdb-typed.hh index 9c15365..4f23dc3 100644 --- a/lmdb-typed.hh +++ b/lmdb-typed.hh @@ -885,12 +885,16 @@ public: //! Deletes an item from the main database and from indexes. template void del(IDType id) { - auto t = ElementType(); - if (!this->get(id, t)) { - return; + if constexpr (std::tuple_size_v) { + auto t = ElementType(); + if (!this->get(id, t)) { + return; + } + (*d_txn)->del(d_parent->d_main, id); + clearIndex(id, t); + } else { + (*d_txn)->del(d_parent->d_main, id); } - (*d_txn)->del(d_parent->d_main, id); - clearIndex(id, t); } //! Clears the database and indexes.