parent
1426f1c8ea
commit
8206569d63
|
@ -494,37 +494,5 @@ struct hb_map_t : hb_hashmap_t<hb_codepoint_t,
|
||||||
hb_map_t (const Iterable &o) : hashmap (o) {}
|
hb_map_t (const Iterable &o) : hashmap (o) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename K, typename V>
|
|
||||||
static inline
|
|
||||||
hb_hashmap_t<K, V>* hb_hashmap_create ()
|
|
||||||
{
|
|
||||||
using hashmap = hb_hashmap_t<K, V>;
|
|
||||||
hashmap* map;
|
|
||||||
if (!(map = hb_object_create<hashmap> ()))
|
|
||||||
return nullptr;
|
|
||||||
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename K, typename V>
|
|
||||||
static inline
|
|
||||||
void hb_hashmap_destroy (hb_hashmap_t<K, V>* map)
|
|
||||||
{
|
|
||||||
if (!hb_object_destroy (map))
|
|
||||||
return;
|
|
||||||
|
|
||||||
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 */
|
#endif /* HB_MAP_HH */
|
||||||
|
|
|
@ -237,16 +237,6 @@ main (int argc, char **argv)
|
||||||
m.keys_ref ();
|
m.keys_ref ();
|
||||||
m.values_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);
|
|
||||||
const hb::unique_ptr<hb_hashmap_t<int, int>> *v1;
|
|
||||||
m.has (0, &v1);
|
|
||||||
hb::unique_ptr<hb_hashmap_t<int, int>> *v2;
|
|
||||||
m.has (0, &v2);
|
|
||||||
}
|
|
||||||
/* Test hashmap with complex shared_ptrs as keys. */
|
/* Test hashmap with complex shared_ptrs as keys. */
|
||||||
{
|
{
|
||||||
hb_hashmap_t<hb::shared_ptr<hb_map_t>, unsigned> m;
|
hb_hashmap_t<hb::shared_ptr<hb_map_t>, unsigned> m;
|
||||||
|
|
Loading…
Reference in New Issue