Actions

icon Post
text/html Subscribe
text/html Unsubscribe

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

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


  • To: Jules Bergmann <jules@xxxxxxxxxxxxxxxx>
  • Subject: Re: [vsipl++] proposal: a typed alloc_align()
  • From: Mark Mitchell <mark@xxxxxxxxxxxxxxxx>
  • Date: Thu, 03 Nov 2005 07:58:00 -0800

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@xxxxxxxxxxxxxxxx
(916) 791-8304