proposal: a typed alloc_align()

Stefan Seefeld stefan at codesourcery.com
Thu Nov 3 01:52:55 UTC 2005


I'v seen expressions such as

foo = static_cast<some_type>(alloc_align(align, size));

a lot recently, and I wonder whether this could be tidied up a bit by parametrizing
alloc_align (i.e. internalizing the static_cast):

template <typename R>
inline
R
alloc_align(size_t align, size_t size)
{
   return static_cast<R>(alloc_align(align, size));
}

and then be able to write

foo = alloc_align<some_type>(align, size);

That avoids users of alloc_align being exposed to void *.

Thoughts ?

Regards,
		Stefan



More information about the vsipl++ mailing list