[object] Forward hb_object_create() arguments to constructor
This commit is contained in:
parent
df040de9b4
commit
2eda2ab3bb
|
@ -214,15 +214,15 @@ static inline void hb_object_trace (const Type *obj, const char *function)
|
||||||
obj ? obj->header.ref_count.get_relaxed () : 0);
|
obj ? obj->header.ref_count.get_relaxed () : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Type>
|
template <typename Type, typename ...Ts>
|
||||||
static inline Type *hb_object_create ()
|
static inline Type *hb_object_create (Ts... ds)
|
||||||
{
|
{
|
||||||
Type *obj = (Type *) hb_calloc (1, sizeof (Type));
|
Type *obj = (Type *) hb_calloc (1, sizeof (Type));
|
||||||
|
|
||||||
if (unlikely (!obj))
|
if (unlikely (!obj))
|
||||||
return obj;
|
return obj;
|
||||||
|
|
||||||
new (obj) Type;
|
new (obj) Type (std::forward<Ts> (ds)...);
|
||||||
|
|
||||||
hb_object_init (obj);
|
hb_object_init (obj);
|
||||||
hb_object_trace (obj, HB_FUNC);
|
hb_object_trace (obj, HB_FUNC);
|
||||||
|
|
Loading…
Reference in New Issue