Bugzilla – Bug 1678
C++11 compliance problem with std::pair
Last modified: 2013-05-25 07:03:01 UTC
Created attachment 1595 [details] patch for the issue What: Improper use of std::make_pair. The problem is explained in this answer: http://stackoverflow.com/a/9642232 Fortunately this is very simple to fix (see patch). Where: ipv6-extension.cc line 350 ipv6-extension.cc line 614 ipv4-l3-protocol.cc line 1332 Reproduce: 1. Clone the latest ns3-dev ("hg clone http://code.nsnam.org/ns-3-dev") 2. Open the ns3-dev/wscript in your favorite editor and add to the configure function env.append_value('CXXFLAGS', '--std=c++0x') to enable all the new c++11 sugar. 3. Run "./waf configure" 4. Run "./waf build -v" and check that the files get compiled with the --std=c++0x option Fix: See attached patch.
Hi Morten, you can also use $ CXXFLAGS="--std=c++0x" ./waf configure $ ./waf build I will take a look at the patch.
+0.5. There are some more occurrences where the make_pair isn't used correctly. Using grep I find: src/internet/model/ipv4-l3-protocol.cc: m_fragments.insert (it, std::make_pair<Ptr<Packet>, uint16_t> (fragment, fragmentOffset)); src/internet/model/ipv6-extension.cc: std::pair<Ipv6Address, uint32_t> fragmentsId = std::make_pair<Ipv6Address, uint32_t> (src, identification); src/internet/model/ipv6-extension.cc: unfragmentablePart.push_back (std::make_pair<Ipv6ExtensionHeader *, uint8_t> (hopbyhopHeader, Ipv6Header::IPV6_EXT_HOP_BY_HOP)); src/internet/model/ipv6-extension.cc: unfragmentablePart.push_back (std::make_pair<Ipv6ExtensionHeader *, uint8_t> (routingHeader, Ipv6Header::IPV6_EXT_ROUTING)); src/internet/model/ipv6-extension.cc: unfragmentablePart.push_back (std::make_pair<Ipv6ExtensionHeader *, uint8_t> (destinationHeader, Ipv6Header::IPV6_EXT_DESTINATION)); src/internet/model/ipv6-extension.cc: m_packetFragments.insert (it, std::make_pair<Ptr<Packet>, uint16_t> (fragment, fragmentOffset)); Update the patch to fix 'em all please, then feel free to push it. T.
Created attachment 1602 [details] Updated patch Sorry for the delay, got busy with some other stuff. Anyway this patch should fix all uses of std::make_pair.
Pushed in changeset: 9813:16f65595bdf8