From: Tom Widmer (tom_usenet_at_[hidden])
Date: 2004-03-05 13:07:16
On Fri, 5 Mar 2004 07:59:31 -0800, "Robert Ramey" <ramey_at_[hidden]>
>Joaqu?n M? L?pez Mu?oz wrote:
>>"serialization/collections_load_imp.hpp" defines a private template
>>class stack_allocate for stack-based reservation of uninitialized
>>memory. To the best of my knowledge, the way it does so
>>is not std-conformant due to alignment issues.
>>Fortunately, (undocumented) "boost/aligned_storage.hpp" provides
>>a template class named aligned_storage which handles the issue,
>>so I guess the problem can be solved by just using this
>>facility instead of stack_allocate.
>This has been mentioned before. I was unable to find any information other
>than the code itself which wasn't all that transparent to me. And the stack
>allocate was soooooo simple. Is aligned_storage part of boost? Is it
>documented anywhere? Is it part of any test suite? Has it been tested for
>portability? In general I would prefer a boostified component over a
>homebrew one. I'm really not sure of what the status of aligned_storage is.
>Also, the nameitself didn't make it clear to me that its intended purpose
>was identical to that implemented by stack_allocate.
It's a fully documented part of Boost type_traits, assuming you are
just after a POD type with a certain alignment:
Identifies the alignment requirements of T. Actually returns a value
that is only guaranteed to be a multiple of the actual alignment
requirements of T.
T must be a complete type.
Attempts to find a built-in or POD type with an alignment that is a
multiple of Align.
-- C++ FAQ: http://www.parashift.com/c++-faq-lite/ C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk