Add EMPLACE support for priority queue

This commit is contained in:
Patrick Pelissier committed 2022-05-10 23:10:44 +02:00
1 parent 71151770fd
commit 154865f0f1
1 file changed
+20 -1
+20 -1
View File
@@ -482,7 +482,26 @@
{ \
return M_C(name, _array_in_serial)(p->array, f); \
} \
,/* No in_SERIAL */)
,/* No in_SERIAL */) \
\
M_EMPLACE_QUEUE_DEF(name, prioqueue_t, M_C(name, _emplace), oplist, M_PR1OQUEUE_EMPLACE_DEF)
/* Definition of the emplace_back function for priority queue
Nothing particular to note: we go through the slow path.
*/
#define M_PR1OQUEUE_EMPLACE_DEF(name, name_t, function_name, oplist, init_func, exp_emplace_type) \
static inline void \
function_name(name_t v \
M_EMPLACE_LIST_TYPE_VAR(a, exp_emplace_type) ) \
{ \
M_C(name, _subtype_ct) data; \
/* Need to construct the object BEFORE, \
so that we can perform comparison on it when inserting it */ \
M_EMPLACE_CALL_FUNC(a, init_func, oplist, data, exp_emplace_type); \
M_C(name, _push)(v, data); \
M_CALL_CLEAR(oplist, data); \
}
// TODO: set all & remove all function