1

トポロジ ヘルパーIpv4AddressHelperを使用すると、例に示すようにベース アドレスを設定できます。

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ですか?

4

1 に答える 1