1
拓撲幫助程序Ipv4AddressHelper
允許設置基地址,如示例中所示。將字符串傳遞到ns3 :: Ipv4AddressHelper :: SetBase方法
Ipv4AddressHelper address;
address.SetBase ("10.1.1.0", "255.255.255.0");
我想存儲動態創建的任意數量的地址,例如。
...
for(uint32_t subnetC = 0; subnetC < nSubnets; subnetC++)
{
string ip = "10.1." + lexical_cast<string>(subnetC + 1) +".0";
ipList.push_back(ip);
}
...
vIpv4AddressHelper[ someIndex ].SetBase(ipList[ someIndex ], "255.255.255.0");
...
但是,我得到的錯誤
error: no matching function for call to ‘ns3::Ipv4AddressHelper::SetBase(std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, const char [14])’
note: candidates are: void ns3::Ipv4AddressHelper::SetBase(ns3::Ipv4Address, ns3::Ipv4Mask, ns3::Ipv4Address)
如何傳遞一個字符串SetBase
?
謝謝Andri C.S.!很棒! : - )以方法名稱「Ipv4Address」替代IpV4Adress和Ipv4Mask代替IpV4Mask – 2013-04-09 10:33:11
不用客氣!並感謝您的更正,我會立即改變這個帖子! – 2013-04-09 10:34:03