title: CPtrList - How to get index of a element?
body: <p>How to get index of a element in the <code>CPtrList</code>?</p>
  
  <pre><code>class CAge
  {
  
  public:
  
  CAge(int nAge){m_nAge=nAge;}
  
  int m_nAge;
  
  };
  
  
  
  typedef CTypedPtrList &lt;CPtrList, CAge*&gt; CAgePtrList;
  
  CAgePtrList list;
  
  POSITION pos;
  
  CAge *p1 = new CAge(21);
  
  CAge *p2 = new CAge(40);
  
  list.AddTail(p1);
  list.AddTail(p2); 
  
  POSITION pos1 = list.GetHeadPosition();
  POSITION pos2 = list.Find(p2,NULL);
  int nIndex=pos2-pos1;
  </code></pre>
  
  <p>If I subtract <code>pos2</code> from <code>pos1</code> I am getting the value <code>12</code>. I expect the value <code>1</code> since it is 2nd element.</p>
  
  <p>How to get index of a element?</p>