title: C++ class/structure data member offset as constant expression
body: <p>Taking offset of a data member is as easy as this:</p>
  
  <pre><code>#define MEMBER_OFFSET(Type, Member) \
      ((unsigned long)(((char *)&amp;((Type *)0)-&gt;Member) - (char *)0));
  </code></pre>
  
  <p>I want to make this a constant compile-time expression (or use type traits). For example, to use it to implement SFINAE based solutions using member offsets, use it static assertions etc.</p>
  
  <p><strong>UPDATE:</strong> The question is - how to make it a compile-time expression. Not whether it works with POD types, or is there a standard macro in C library etc.</p>