Re: [boost] shared_ptr extension with counter in object header
Greg On Sunday 23 February 2003 20:03, Greg Colvin wrote: > At 03:34 AM 2/23/2003, Thomas Witt wrote: > >Greg, > > > >I can not figure out how you make sure to satisfy the alignment > > constraints of T and counted_base_header_impl. Any hint would be > > appreciated. > > I just used two char arrays, thinking there was a dispensation > somewhere in the standard to allow for placement new into char > arrays: Yep, you are right its 5.3.4/10. I missed it. Thomas -- Dipl.-Ing. Thomas Witt Institut fuer Verkehrswesen, Eisenbahnbau und -betrieb, Universitaet Hannover voice: +49(0) 511 762 - 4273, fax: +49(0) 511 762-3001 http://www.ive.uni-hannover.de ___ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Re: [boost] shared_ptr extension with counter in object header
At 03:34 AM 2/23/2003, Thomas Witt wrote: >Greg, > >I can not figure out how you make sure to satisfy the alignment constraints of >T and counted_base_header_impl. Any hint would be appreciated. I just used two char arrays, thinking there was a dispensation somewhere in the standard to allow for placement new into char arrays: template struct object_with_counted_header { char header[sizeof(counted_base_header_impl >)]; char object[sizeof(T)]; }; If I'm wrong, an alternative might be: template struct object_with_counted_header { counted_base_header_impl > header; T object; }; But then you can't use offsetof, and some fancier tricks will be in order. ___ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Re: [boost] shared_ptr extension with counter in object header
Greg, I can not figure out how you make sure to satisfy the alignment constraints of T and counted_base_header_impl. Any hint would be appreciated. Thanks Thomas -- Dipl.-Ing. Thomas Witt Institut fuer Verkehrswesen, Eisenbahnbau und -betrieb, Universitaet Hannover voice: +49(0) 511 762 - 4273, fax: +49(0) 511 762-3001 http://www.ive.uni-hannover.de ___ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost