title: How to calculate offset of a class member at compile time?
body: <p>Given a class definition in C++</p>
  
  <pre><code>class A
  {
    public:
      //methods definition
      ....
  
    private:
      int i;
      char *str;
      ....
  }
  </code></pre>
  
  <p>Is it possible to calculate the offset of a class member at compile time using C++ template meta-programming? The class is not POD, and can have virtual methods, primitive and object data member. </p>