简体   繁体   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}

I am trying to cast TracedValue<uint32_t> m_bytesInFlight to uint32_t but I get the following error 我正在尝试将TracedValue<uint32_t> m_bytesInFlightuint32_t,但出现以下错误

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

Function prototype and variable declarations are 函数原型和变量声明是

uint32_t UnAckDCount (void) const;

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

Here i am calling the function 在这里我正在调用函数

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

Please suggest some method so that I can execute the return statement to get the result. 请提出一些方法,以便我可以执行return语句以获取结果。 Thanks in advance 提前致谢

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

Seeing the compiler error, it's easy to figure out that variable m_highTxMark is of type ns3::TracedValue<ns3::SequenceNumber<unsigned int, int> > . 看到编译器错误,很容易发现变量m_highTxMark的类型为ns3::TracedValue<ns3::SequenceNumber<unsigned int, int> > I checked the documentation of ns3::TracedValue and ns3::SequenceNumber , they both have getter functions Get() and GetValue() respectively. 我检查了ns3::TracedValuens3::SequenceNumber的文档,它们都分别具有getter函数Get()和GetValue()。

See: 看到:

https://www.nsnam.org/doxygen/classns3_1_1_traced_value.html https://www.nsnam.org/doxygen/classns3_1_1_sequence_number.html 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.

相关问题 C++ 从 'std::__tuple... {aka 'unsigned int*'} 转换为 'uint32_t' {aka 'unsigned int'} 失去精度 - C++ Cast from ‘std::__tuple… {aka ‘unsigned int*’} to ‘uint32_t’ {aka ‘unsigned int’} loses precision 从“const char*”到“uint32_t {aka unsigned int}”的无效转换[-fpermissive] - invalid conversion from ‘const char*’ to ‘uint32_t {aka unsigned int}’ [-fpermissive] 错误:&#39;&#39;无法将&#39;uint8 * {aka unsigned int *}&#39;转换为&#39;const emxArray_uint8_T&#39;&#39;?&#39;? - error: ''cannot convert 'uint8* {aka unsigned int*}' to 'const emxArray_uint8_T*'?'? 如何区分unsigned int和uint32_t - How to distinguish unsigned int from uint32_t 一个使用uint32_t代替unsigned int的实际示例 - A practical example using uint32_t instead of unsigned int “ uint32_t”的“ long unsigned int”模棱两可的调用 - Ambiguous Call of “long unsigned int” for “uint32_t” NS3 C ++ UdpEchoClientApplication错误 - NS3 C++ UdpEchoClientApplication error 时间:2019-05-06 标签:c++uint,unsignedint,int - c++ uint , unsigned int , int Uint32和C ++中的unsigned int有什么区别? - What is the difference between an Uint32 and an unsigned int in C++? 错误:无法将&#39;long unsigned int(A :: *)()&#39;转换为&#39;poFunc {aka long unsigned int(*)()}&#39; - error: cannot convert 'long unsigned int (A::*)()' to 'poFunc {aka long unsigned int (*)()}'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM