Since you declared your heap as mutable, the push
operation is supposed to return the handle_t
you typedefed as the handle_type
:
mpl::if_c< is_mutable, handle_type, void >::type push(value_type const & v);
In the respect of obtaining the handle, your code is fine. To simplify a bit to make it clearer:
void push (const myType * c) {
handle_t handle = heap_.push(c);
handles_[c->getIndex()] = handle;
}
As a side-note, you should have a typedef for the heap instead of repeating it in the declarations, and the typename
is superfluous (at least in the snippet you posted in the question.)