title: using structs in a STL list c++
body: <p>I'm new to using c++ and I don't really know how to use the STL lists. I'm making a graph of intersections of city streets. Here's my structs/header files:</p>
  
  <p>global header</p>
  
  <pre><code>#ifndef GLOBAL_H
  #define GLOBAL_H
  
  typedef struct Vertex_ vertex;
  typedef struct Edge_ ege;
  
  #endif
  </code></pre>
  
  <p>vertex header</p>
  
  <pre><code>#ifndef VERTEX_H
  #define VERTEX_H
   #include&lt;list&gt;
  #include "global.h"
  #include "edgelist.h"
  struct Vertex_{
      int xsect;
      int danger;
      char xstreet[25];
  
      list&lt;Edge_&gt; EdgeList;
      struct Vertex_ *next;
      struct Vertex_ *prev;
  };   
  
   #endif
  </code></pre>
  
  <p>edge header</p>
  
  <pre><code>#ifndef EDGE_H
  #define EDGE_H
  
  #include "global.h"
  #include "vertex.h"
  struct Edge_{
      Vertex_ *adjvertex;
      int distance;
  
      struct Edge_ *next;
      struct Edge_ *prev;
  };  
  
  #endif
  </code></pre>
  
  <p>My instructor didn't give us any notes on c++ so don't really know how to start the graph. Here's how I was thinking of starting my main:</p>
  
  <pre><code>#include&lt;iostream&gt;
  #include&lt;list&gt;
  #include "vertex.h"
  #include "edge.h"
  #include "global.h"
  int main(){
     list&lt;Vertex_&gt; xsection;
     list&lt;Edge_&gt; EdgeList;
  }
  </code></pre>
  
  <p>I have to scan in the data from another file so I don't really know what the size of the list will be. The question is whether or not I need to initialize the size of the list or if I can just add stuff using an iterator. Another question is how do I access the data within the elements of this list. Would I just use an iterator and have:</p>
  
  <pre><code>*iter-&gt;EdgeList.begin(); 
  </code></pre>
  
  <p>If anyone has a website that has all the commands and functions for the STL list and how to use it that would be awesome because I currently have 10 websites open just to see how these lists work.</p>