[map] Enable using hashmap with unique_ptr
This commit is contained in:
parent
53fd4c9236
commit
485f043211
|
@ -479,4 +479,15 @@ void hb_hashmap_destroy (hb_hashmap_t<K, V>* map)
|
|||
hb_free (map);
|
||||
}
|
||||
|
||||
namespace hb {
|
||||
|
||||
template <typename K, typename V>
|
||||
struct vtable<hb_hashmap_t<K, V>>
|
||||
{
|
||||
static constexpr auto destroy = hb_hashmap_destroy<K,V>;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif /* HB_MAP_HH */
|
||||
|
|
|
@ -212,6 +212,12 @@ main (int argc, char **argv)
|
|||
m.keys_ref ();
|
||||
m.values_ref ();
|
||||
}
|
||||
/* Test more complex unique_ptr's. */
|
||||
{
|
||||
hb_hashmap_t<int, hb::unique_ptr<hb_hashmap_t<int, int>>> m;
|
||||
|
||||
m.get (0);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue