mardi 8 octobre 2019

Can not compile the code because it is deprecated in C++11

I have a code compiling with ns-3, but I meet some problems when I try to compile them. I think the reason might be some functions are deprecated in C++11. But I do not know how to revise the code.

Here is the code I think should be revised:

m_sendBuffer.erase(
    std::remove_if(
        m_sendBuffer.begin(), m_sendBuffer.end(),
        std::bind2nd(std::ptr_fun(DsrSendBuffer::IsEqual), dst)
    ),
    m_sendBuffer.end()
);

Here is the error:

../src/dsr/model/dsr-rsendbuff.cc:102:55: error: 'ptr_fun<ns3::dsr::DsrSendBuffEntry, ns3::Ipv4Address, bool>' is deprecated [-Werror,-Wdeprecated-declarations]
                                      std::bind (std::ptr_fun (DsrSendBuffer::IsEqual), dst)), m_sendBuffer.end ());

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/functional:1115:1: note: 'ptr_fun<ns3::dsr::DsrSendBuffEntry, ns3::Ipv4Address, bool>' has been explicitly marked deprecated here
_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_INLINE_VISIBILITY

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__config:1101:39: note: expanded from macro '_LIBCPP_DEPRECATED_IN_CXX11'
define _LIBCPP_DEPRECATED_IN_CXX11 _LIBCPP_DEPRECATED

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__config:1090:48: note: expanded from macro '_LIBCPP_DEPRECATED'
define _LIBCPP_DEPRECATED __attribute__ ((deprecated))

Aucun commentaire:

Enregistrer un commentaire