Actions

icon Post
text/html Subscribe
text/html Unsubscribe

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

proposal: a typed alloc_align()


  • To: VSIPL++ Developers List <vsipl++@xxxxxxxxxxxxxxxx>
  • Subject: proposal: a typed alloc_align()
  • From: Stefan Seefeld <stefan@xxxxxxxxxxxxxxxx>
  • Date: Wed, 02 Nov 2005 20:52:55 -0500

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