title: Use Current Template as a Template Parameter to one of the Template Parameters
body: <p>I am trying to make a generic graph structure, but I am running into this circular dependency between vertices and edges. I define my Vertex and Edge classes like so:</p>
  
  <pre class="lang-cpp prettyprint-override"><code>template&lt;typename EdgeType&gt;
  struct Vertex {
      std::vector&lt;EdgeType&gt; successors;
  };
  
  template&lt;typename EdgeCostType, typename VertexWrapper&gt;
  struct Edge {
      EdgeCostType cost;
      VertexWrapper source;
      VertexWrapper dest;
  };
  </code></pre>
  
  <p>I would like to instantiate it with something like <code>Vertex&lt;Edge&lt;int, std::shared_ptr&lt;decltype(v)&gt;&gt;&gt; v;</code>, but I obviously cannot. What can I do to resolve this circular dependency?</p>
  
  <p>Edit:</p>
  
  <p>I think what this problem boils down to is using the current template as a template parameter to one of the template parameters of the current template, e.g. how to do something like this:</p>
  
  <pre class="lang-cpp prettyprint-override"><code>template&lt;typename VertexWrapper&gt;
  struct Vertex {
      std::vector&lt;pair&lt;int, VertexWrapper&lt;Vertex&gt;&gt;&gt; successors;
  };
  </code></pre>