title: Emacs, C++ code completion for vectors
body: <p>I am new to Emacs, and 
  I have the following code as a sample.
  I have installed <a href="http://ftp.gnu.org/pub/gnu/emacs/windows/" rel="noreferrer">GNU Emacs 23.1.1 (i386-mingw-nt6.1.7600)</a>, installed <a href="http://cedet.sourceforge.net/" rel="noreferrer">cedet-1.0pre7.tar.gz. </a>, installed <a href="http://tromey.com/elpa/" rel="noreferrer">ELPA</a>, and <a href="http://nschum.de/src/emacs/company-mode/" rel="noreferrer">company</a>.
  You can find my simple Emacs configuration at the bottom.</p>
  
  <p>The problem is, when I type <strong>q[0]</strong> in <strong>main()</strong> and press <strong>.</strong> (dot), I see the 37 members of the vector, not <strong>Person</strong> although <strong>first_name</strong> and <strong>last_name</strong> are expected. The completion works as expected in the function <strong>greet()</strong> but it has nothing to do with vector.</p>
  
  <p>My question is, how can I accomplish code completion for vector elements too?</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;vector&gt;
  using namespace std;
  
  class Person
  {
    public:
      string first_name;
      string last_name;
  };
  
  void greet(Person a_person)
  {
    // a_person.first_name is completed as expected!
    cout &lt;&lt; a_person.first_name &lt;&lt; "|";
    cout &lt;&lt; a_person.last_name &lt;&lt; endl;
  };
  
  int main()
  {
    vector&lt;Person&gt; q(2);
  
    Person guy1;
    guy1.first_name = "foo";
    guy1.last_name = "bar";
  
    Person guy2;
    guy2.first_name = "stack";
    guy2.last_name = "overflow";
  
    q[0] = guy1;
    q[1] = guy2;
    greet(guy1);
    greet(guy2);
    // cout q[0]. I want to see first_name or last_name here!
  }
  </code></pre>
  
  <hr>
  
  <p>My Emacs configuration:</p>
  
  <pre><code>;;; This was installed by package-install.el.
  ;;; This provides support for the package system and
  ;;; interfacing with ELPA, the package archive.
  ;;; Move this code earlier if you want to reference
  ;;; packages in your .emacs.
  (when
      (load
       (expand-file-name "~/.emacs.d/elpa/package.el"))
    (package-initialize))
  
  (load-file "~/.emacs.d/cedet/common/cedet.el")
  (semantic-load-enable-excessive-code-helpers)
  (require 'semantic-ia)
  
  (global-srecode-minor-mode 1)
  (semantic-add-system-include "/gcc/include/c++/4.4.2" 'c++-mode)
  (semantic-add-system-include "/gcc/i386-pc-mingw32/include" 'c++-mode)
  (semantic-add-system-include "/gcc/include" 'c++-mode)
  
  
  (defun my-semantic-hook ()
    (imenu-add-to-menubar "TAGS"))
  (add-hook 'semantic-init-hooks 'my-semantic-hook)
  </code></pre>