title: Absolute fastest (and hopefully elegant) way to return a certain char buffer given a struct type
body: <p>OK first and foremost, performance is most important here so I doubt a map would work.  I have a list of structs (about 16 of them) like </p>
  
  <pre><code>struct A { ... };
  struct B { ... }; 
  ...
  </code></pre>
  
  <p>each are different and each are of different sizes.</p>
  
  <p>I'm wondering what elegant way we might be able to do something along the lines of:</p>
  
  <pre><code>char BufferA[sizeof(struct A)];
  char BufferB[sizeof(struct B)];
  </code></pre>
  
  <p>then write some method or mapping to return BufferA if you are working with struct A.  Speed is definitely the most important, I imagine using templates would help but I'm not sure it the whole thing can be templatized.</p>
  
  <p>Update***  Sorry for not being clear, the buffers are all pre-allocated.  I just need a very fast way to get the proper Buffer given a struct type.</p>
  
  <p>Update 2*** Sorry for not specifying, alignment is an important trait here and I do in fact byte-align each struct with #pragma pack(push, 1)</p>