Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy does g++ complain when using templated typedefs in graph_traits<>?
    text
    copied!<p>When I try to compile this code:</p> <pre><code>struct BasicVertexProperties { Vect3Df position; }; struct BasicEdgeProperties { }; template &lt; typename VERTEXPROPERTIES, typename EDGEPROPERTIES &gt; class Graph { typedef adjacency_list&lt; setS, // disallow parallel edges vecS, // vertex container bidirectionalS, // directed graph property&lt;vertex_properties_t, VERTEXPROPERTIES&gt;, property&lt;edge_properties_t, EDGEPROPERTIES&gt; &gt; GraphContainer; typedef graph_traits&lt;GraphContainer&gt;::vertex_descriptor Vertex; typedef graph_traits&lt;GraphContainer&gt;::edge_descriptor Edge; }; </code></pre> <p>g++ complains with the following error in the "typedef graph_traits&lt;>" line:</p> <pre><code>error: type 'boost::graph_traits&lt;boost::adjacency_list&lt;boost::setS, boost::vecS, boost::bidirectionalS, boost::property&lt;vertex_properties_t, VERTEXPROPERTIES, boost::no_property&gt;, boost::property&lt;edge_properties_t, EDGEPROPERTIES, boost::no_property&gt;, boost::no_property, boost::listS&gt; &gt;' is not derived from type 'Graph&lt;VERTEXPROPERTIES, EDGEPROPERTIES&gt;' </code></pre> <p>I found out that the compiler seems not to know that my template parameters are types, but putting "typename" before them in the property definition doesn't help.</p> <p>What is wrong? I simply want to have a templated Graph class to have the possibility to use whatever properties I like, derived from the basic property structs defined above, so I can have methods in this Graph that operate on the basic properties.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload