Bugzilla – Bug 2021
Missing const qualifier in TopologyReader::Link::Attributes{Begin,End}()
Last modified: 2014-11-18 18:50:40 UTC
Created attachment 1923 [details] Added missing const qualifier to TopologyReader::Link::Attributes{Begin,End}() This patch fixes a problem I ran into when using AttributesBegin/End as follows: <code> Ptr<TopologyReader> topoFile; //(...) TopologyReader::ConstLinksIterator iter = topoFile->LinksBegin(); for (;iter != topoFile->LinksEnd(); iter++) { TopologyReader::Link::ConstAttributesIterator it = iter->AttributesBegin(); for(;it != iter->AttributesEnd(); it++) { std::cout << "Key: " << it->first << " Value: "<< it->second << std::endl; } } </code> The resulting error was: <code> ../scratch/SFL/topology.cc:60:82: error: passing ‘const ns3::TopologyReader::Link’ as ‘this’ argument of ‘ns3::TopologyReader::Link::ConstAttributesIterator ns3::TopologyReader::Link::AttributesBegin()’ discards qualifiers [-fpermissive] TopologyReader::Link::ConstAttributesIterator it = iter->AttributesBegin(); ^ ../scratch/SFL/topology.cc:61:40: error: passing ‘const ns3::TopologyReader::Link’ as ‘this’ argument of ‘ns3::TopologyReader::Link::ConstAttributesIterator ns3::TopologyReader::Link::AttributesEnd()’ discards qualifiers [-fpermissive] for(;it != iter->AttributesEnd(); it++) { </code>
changeset: 11063:3bfdbd13f978 Thanks Nuno :)