Boost Users :
Subject: [Boost-users] alignment question
From: Slawomir Lisznianski (slisznia_at_[hidden])
Date: 2009-12-22 19:40:39
I'm having trouble implementing properly aligned storage. The
following example shows conceptually what I'm trying to do, but it's
NOT a correct way of doing it.
template <typename T>
size_t len = sizeof(T);
// <--- compiler may pad here, hence this doesn't work...
So, given an arbitrary type T, we want to create an envelope that will
have the size of T immediately before it, with no padding between len
The user would then be able to:
env.body.x = ...
I'm curious if anyone has run into something similar and have a clean
solution. Our code currently has to defer to temporary buffers and
memcpy'ing data back to it.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net