Skip to content

Instantly share code, notes, and snippets.

@SzymonSzott
Created October 24, 2018 10:17
Show Gist options
  • Select an option

  • Save SzymonSzott/b0f868597aa18c94b0a0745c0ce05680 to your computer and use it in GitHub Desktop.

Select an option

Save SzymonSzott/b0f868597aa18c94b0a0745c0ce05680 to your computer and use it in GitHub Desktop.
[ns-3] Iterate over node container
NodeContainer c;
c.Create (numNodes);
/*...*/
for(NodeContainer::Iterator n = c.Begin (); n != c.End (); n++)
{
Ptr<Node> object = *n;
uint32_t id = object->GetId();
std::cout <<"Node Number "<< id << std::endl;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment