[cplusplus] Adjustments
This commit is contained in:
parent
0b35940a72
commit
0d3d5b62ae
|
@ -49,9 +49,10 @@ struct vtable;
|
|||
template <typename T>
|
||||
struct shared_ptr
|
||||
{
|
||||
using element_type = T;
|
||||
|
||||
using v = vtable<T>;
|
||||
|
||||
shared_ptr (std::nullptr_t) : p (nullptr) {}
|
||||
explicit shared_ptr (T *p = nullptr) : p (p) {}
|
||||
shared_ptr (const shared_ptr &o) : p (v::reference (o.p)) {}
|
||||
shared_ptr (shared_ptr &&o) : p (o.p) { o.p = nullptr; }
|
||||
|
@ -84,6 +85,11 @@ struct shared_ptr
|
|||
T *p;
|
||||
};
|
||||
|
||||
template<typename T> struct is_shared_ptr : std::false_type {};
|
||||
template<typename T> struct is_shared_ptr<shared_ptr<T>> : std::true_type {};
|
||||
|
||||
// TODO Implement hash<> and atomic<>
|
||||
|
||||
template <typename T,
|
||||
T * (*_get_empty) (void),
|
||||
T * (*_reference) (T *),
|
||||
|
|
|
@ -223,13 +223,15 @@ main (int argc, char **argv)
|
|||
}
|
||||
|
||||
/* Test hb::shared_ptr. */
|
||||
hb_hash (hb::shared_ptr<hb_set_t> ());
|
||||
#if 0
|
||||
{
|
||||
hb_hashmap_t<hb::shared_ptr<hb_set_t>, hb::shared_ptr<hb_set_t>, std::nullptr_t, std::nullptr_t, nullptr, nullptr> m;
|
||||
|
||||
hb_hash (hb::shared_ptr<hb_set_t> ());
|
||||
m.get (hb::shared_ptr<hb_set_t> ());
|
||||
m.get (hb::shared_ptr<hb_set_t> (hb_set_get_empty ()));
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue