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<typename T> struct object_with_counted_header {
      char header[sizeof(counted_base_header_impl<T*,checked_deleter<T> >)];
      char object[sizeof(T)];
   };

If I'm wrong, an alternative might be:

   template<typename T> struct object_with_counted_header {
      counted_base_header_impl<T*,checked_deleter<T> > 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

Reply via email to