Re: Create object in buffer w/ placement new?
From: Jonathan Turkanis (technews_at_kangaroologic.com)
Date: 03/24/04
- Next message: Steven T. Hatton: "A Study of the Study of C++?"
- Previous message: kristiek: "Re: help with arrays"
- In reply to: Derek: "Create object in buffer w/ placement new?"
- Next in thread: Jonathan Turkanis: "Re: Create object in buffer w/ placement new?"
- Reply: Jonathan Turkanis: "Re: Create object in buffer w/ placement new?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 24 Mar 2004 13:29:21 -0700
"Derek" <none@cheese.com> wrote in message
news:c3sol6$2c6h2r$1@ID-46268.news.uni-berlin.de...
> My understanding is that only operator new returns memory that
> is suitably aligned for any object. Does this mean that
> constructing an object in a buffer is not allowed unless that
> buffer was itself allocated by new?
There are other ways to guarantee alignment, but they are not 100%
standard conforming. See
http://www.boost.org/doc/html/variant.misc.htm (portability)
http://www.boost.org/libs/type_traits/index.html
(type_with_alignment)
The implementation is here:
http://www.boost.org/boost/type_traits/type_with_alignment.hpp
Jonathan
- Next message: Steven T. Hatton: "A Study of the Study of C++?"
- Previous message: kristiek: "Re: help with arrays"
- In reply to: Derek: "Create object in buffer w/ placement new?"
- Next in thread: Jonathan Turkanis: "Re: Create object in buffer w/ placement new?"
- Reply: Jonathan Turkanis: "Re: Create object in buffer w/ placement new?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|