Note that there are some explanatory texts on larger screens.

plurals
  1. POMatching function arguments in generic priority queue type
    primarykey
    data
    text
    <p>I use an external library which provides a generic priority queue type implementation. Priority queue's class (declared in a header file, call it priorityQueue.h) is</p> <pre><code>template &lt;typename KeyType, typename DataType, template &lt;typename datatype&gt; class StorageType&gt; class PriorityQueue {...}; </code></pre> <p>which contains an insert function:</p> <pre><code>//Insert a key-value pair to the priority queue void insert( const KeyType&amp; key, const DataType&amp; data, const DescriptorType ptr = 0) </code></pre> <p>I need this priority queue to store items of the struct below into:</p> <pre><code> struct certificate { float tfail; typename GraphType::NodeIterator n; unsigned int ne, citem; }; </code></pre> <p>so i've implemented this function:</p> <pre><code>void storeCertificates(const NodeIterator&amp; u, int node_or_edge) { //representation: (ne, idn, tfail), for a node identified by idn if we have a min cert (ne= 0), or a tail of an edge identified by idn if we have a pr cert (ne=1) certificate cert; int ne; if(node_or_edge == 0) //min certificate ne = 0; else //prim certificate ne = 1; cert.ne = ne; cert.n = u; cert.tfail = u-&gt;tfail; cert.citem = 0; c.insert( cert.tfail, cert, cert.citem); //&lt;========= } </code></pre> <p>which stores a cert item into a priority queue defined as:</p> <pre><code> typedef PriorityQueue&lt; WeightType, NodeIterator, HeapStorage&gt; PriorityQueueType; PriorityQueueType c; </code></pre> <p>In compile time, i get the following error:</p> <pre><code>td_dijkstra_and_os.h:680:2: error: function does not match call to ‘PriorityQueue&lt;float, std::_List_iterator&lt;ALNode&lt;node, edge&gt; &gt;, HeapStorage&gt;::insert(float&amp;, TD_Dijkstra_OS&lt;DynamicGraph&lt;AdjacencyListImpl, node, edge&gt; &gt;::certificate&amp;, unsigned int&amp;)’ td_dijkstra_and_os.h:680:2: note: candidate is: /home/danuser/eCOMPASS/pgl/include/Structs/Trees/priorityQueue.h:132:10: σημείωση: void PriorityQueue&lt;KeyType, DataType, StorageType&gt;::insert(const KeyType&amp;, const DataType&amp;, PriorityQueue&lt;KeyType, DataType, StorageType&gt;::DescriptorType) [with KeyType = float, DataType = std::_List_iterator&lt;ALNode&lt;node, edge&gt; &gt;, StorageType = HeapStorage, PriorityQueue&lt;KeyType, DataType, StorageType&gt;::DescriptorType = unsigned int*, PQSizeType = unsigned int] /home/danuser/eCOMPASS/pgl/include/Structs/Trees/priorityQueue.h:132:10: σημείωση: no known conversion for argument 2 from ‘TD_Dijkstra_OS&lt;DynamicGraph&lt;AdjacencyListImpl, node, edge&gt; &gt;::certificate’ to ‘const std::_List_iterator&lt;ALNode&lt;node, edge&gt; &gt;&amp;’ </code></pre> <p>Please, provide a correct way to use this insertion function for my implementation.</p> <p>EDIT: Can someone provide an implementation of this by using std::priority_queue or, even better boost's priority queue?</p>
    singulars
    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.
 

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