Allow specifying `ElementType` on index-ed `get` function as well

This commit is contained in:
Martchus 2022-05-28 18:28:31 +02:00
parent 827bd843b3
commit 9a9bed0f46
1 changed files with 2 additions and 2 deletions

View File

@ -379,12 +379,12 @@ public:
}
//! Get item through index N, then via the main database
template <std::size_t N> IDType get(const index_t<N> &key, T &out)
template <std::size_t N, typename ElementType = T> IDType get(const index_t<N> &key, ElementType &out)
{
auto idValue = MDBOutVal();
if (!(*d_parent.d_txn)->get(std::get<N>(d_parent.d_parent->d_tuple).d_idx, keyConv(key), idValue)) {
const auto id = idValue.get<IDType>();
if (get(id, out)) {
if (get<ElementType>(id, out)) {
return id;
}
}