繁体   English   中英

C ++:错误:无法转换&#39;ns3 :: TracedValue <ns3::SequenceNumber<unsigned int, int> &gt;&#39;到&#39;uint32_t {aka unsigned int}

[英]c++: error: cannot convert ‘ns3::TracedValue<ns3::SequenceNumber<unsigned int, int> >’ to ‘uint32_t {aka unsigned int}

我正在尝试将TracedValue<uint32_t> m_bytesInFlightuint32_t,但出现以下错误

 error: cannot convert ‘ns3::TracedValue<ns3::SequenceNumber<unsigned int, int> >’ to ‘uint32_t {aka unsigned int}

函数原型和变量声明是

uint32_t UnAckDCount (void) const;

TracedValue<uint32_t>  m_bytesInFlight {0};        //!< Bytes in flight

在这里我正在调用函数

uint32_t 
TcpSocketBase::UnAckDCount () const
{
  return m_tcb->m_highTxMark - (uint32_t) m_tcb->m_bytesInFlight;
}

请提出一些方法,以便我可以执行return语句以获取结果。 提前致谢

m_tcb->m_highTxMark更改为m_tcb->m_highTxMark.Get().GetValue()应该可以。

看到编译器错误,很容易发现变量m_highTxMark的类型为ns3::TracedValue<ns3::SequenceNumber<unsigned int, int> > 我检查了ns3::TracedValuens3::SequenceNumber的文档,它们都分别具有getter函数Get()和GetValue()。

看到:

https://www.nsnam.org/doxygen/classns3_1_1_traced_value.html https://www.nsnam.org/doxygen/classns3_1_1_sequence_number.html

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM