Note that there are some explanatory texts on larger screens.

plurals
  1. POCan I wrap boost graph with my own class
    primarykey
    data
    text
    <p>I am trying to cerate my own class with <strong>boost::adjacency_matrix</strong> graph as a member, but I am stuck on compilation error. Sample class that won't compile:</p> <pre><code>namespace zto { typedef boost::adjacency_matrix&lt;boost::undirectedS&gt; Graph; class SampleClass { public: Graph g; SampleClass(); }; </code></pre> <p>And the compilation error:</p> <pre><code>./src/sample.cpp: In constructor ‘zto::SampleClass::SampleClass()’: ./src/sample.cpp:27:31: error: no matching function for call to ‘boost::adjacency_matrix&lt;boost::undirectedS&gt;::adjacency_matrix()’ ./src/sample.cpp:27:31: note: candidates are: /usr/include/boost/graph/adjacency_matrix.hpp:622:5: note: template&lt;class EdgeIterator, class EdgePropertyIterator&gt; boost::adjacency_matrix::adjacency_matrix(EdgeIterator, EdgeIterator, EdgePropertyIterator, boost::adjacency_matrix&lt;Directed, VertexProperty, EdgeProperty, GraphProperty, Allocator&gt;::vertices_size_type, const GraphProperty&amp;) /usr/include/boost/graph/adjacency_matrix.hpp:604:5: note: template&lt;class EdgeIterator&gt; boost::adjacency_matrix::adjacency_matrix(EdgeIterator, EdgeIterator, boost::adjacency_matrix&lt;Directed, VertexProperty, EdgeProperty, GraphProperty, Allocator&gt;::vertices_size_type, const GraphProperty&amp;) /usr/include/boost/graph/adjacency_matrix.hpp:593:5: note: boost::adjacency_matrix&lt;Directed, VertexProperty, EdgeProperty, GraphProperty, Allocator&gt;::adjacency_matrix(boost::adjacency_matrix&lt;Directed, VertexProperty, EdgeProperty, GraphProperty, Allocator&gt;::vertices_size_type, const GraphProperty&amp;) [with Directed = boost::undirectedS, VertexProperty = boost::no_property, EdgeProperty = boost::no_property, GraphProperty = boost::no_property, Allocator = std::allocator&lt;bool&gt;, boost::adjacency_matrix&lt;Directed, VertexProperty, EdgeProperty, GraphProperty, Allocator&gt;::vertices_size_type = unsigned int] /usr/include/boost/graph/adjacency_matrix.hpp:593:5: note: candidate expects 2 arguments, 0 provided /usr/include/boost/graph/adjacency_matrix.hpp:474:9: note: boost::adjacency_matrix&lt;boost::undirectedS&gt;::adjacency_matrix(const boost::adjacency_matrix&lt;boost::undirectedS&gt;&amp;) /usr/include/boost/graph/adjacency_matrix.hpp:474:9: note: candidate expects 1 argument, 0 provided </code></pre> <p>It looks like that compilator thinks <strong>Graph</strong> is a function?!</p> <p>Can anybody tell me, how to declare <strong>boost::adjacency_matrix</strong> as a member of my class?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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