[vsipl++] proposal: a typed alloc_align()

Mark Mitchell mark at codesourcery.com
Thu Nov 3 15:58:00 UTC 2005


Jules Bergmann wrote:

>     float* foo = alloc_align<float>(align, elem);

Note that you could spell this like:

  new (vsip::impl::align (16)) float[elem]

Then, the compiler will do the cast to float * for you, handle the
multiplication, etc.  You would have a little wrapper class:

  class align {
    align(size_t align): align_(align);
    size_t align_;
  };

and:

  void *operator new[](size_t, const align&) ...

-- 
Mark Mitchell
CodeSourcery, LLC
mark at codesourcery.com
(916) 791-8304



More information about the vsipl++ mailing list