base: Never copy the dealloc argument for destroy

By using &&, we prevent the accidental copying of deallocator instances,
passed to the destroy function. We always want to take the deallocator
as reference or pointer.
This commit is contained in:
Norman Feske 2014-06-06 17:23:58 +02:00
parent 4672ae637a
commit 6125e10be6

View File

@ -218,7 +218,7 @@ namespace Genode {
* was allocated
* \param obj object to destroy
*/
template <typename T, typename DEALLOC> void destroy(DEALLOC dealloc, T *obj);
template <typename T, typename DEALLOC> void destroy(DEALLOC && dealloc, T *obj);
}
void *operator new (Genode::size_t, Genode::Allocator *);
@ -259,7 +259,7 @@ void operator delete (void *, Genode::Deallocator &);
/* implemented here as it needs the special delete operators */
template <typename T, typename DEALLOC>
void Genode::destroy(DEALLOC dealloc, T *obj)
void Genode::destroy(DEALLOC && dealloc, T *obj)
{
if (!obj)
return;