Note that there are some explanatory texts on larger screens.

plurals
  1. POpassing ‘const Link’ as ‘this’ argument of ‘std::string GetAttribute(std::string)’ discards qualifiers
    primarykey
    data
    text
    <p>I'm getting an odd error with parts of the NS-3 API. Here is my error message:</p> <pre><code>error: passing ‘const ns3::TopologyReader::Link’ as ‘this’ argument of ‘std::string ns3::TopologyReader::Link::GetAttribute(std::string)’ discards qualifiers </code></pre> <p>And here is the code causing the issue: </p> <pre><code>TopologyReader::ConstLinksIterator iter; int num = 0; for (iter = topologyReader-&gt;LinksBegin (); iter != topologyReader-&gt;LinksEnd(); iter++, num++) { std::istringstream fromName(iter-&gt;GetFromNodeName ()); std::istringstream toName (iter-&gt;GetToNodeName ()); iter-&gt;GetToNodeName(); std::string w = "Weight"; std::string weightAttr = (iter)-&gt;GetAttribute(w); // &lt;- error /* snip */ } </code></pre> <p>I think it might have to do with the fact that <code>GetAttribute(std::string)</code> is not a <code>const</code> function, according to the <a href="http://www.nsnam.org/doxygen-release/classns3_1_1_topology_reader_1_1_link.html" rel="nofollow">documentation for TopologyReader::Link</a>, while the other functions, <code>GetFromNodeName(void)</code> and <code>GetToNodeName(void)</code> are declared as <code>const</code> functions. However, I'm not sure how to fix this problem.</p> <p>Edit: The function signatures are as shown (from the linked documentation):</p> <pre><code>std::string ns3::TopologyReader::Link::GetFromNodeName (void) const std::string ns3::TopologyReader::Link::GetToNodeName (void) const std::string ns3::TopologyReader::Link::GetAttribute (std::string name) </code></pre>
    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.
    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