Skip to main content
GameDev.net gamedev.net
🔒 Locked

CountOf Array

Started by TheShadow Jan 9, 2005 at 1:20 AM 1 replies 450+ views
Original Post
TheShadow
TheShadow
Hi, i have seen a few ways to get the number of elements in an array but i couldn't make it work while calling it inside a method of a class.

CWeb::CWeb(std::string data, CWeb *Webs)
{
//Code to add all of the Webs into a linked list inside CWeb
//Webs is a pointer to an array of CWeb type objects
}

So basicaly i need to be able to know the number of elements inside Webs in this function. Any ideas? (Passing the number of Webs as another parameter is not acceptable). THanks
Mecha Engineer (Making Real Humanoid Suits)
SiCrane
SiCrane
From an arbitrary bare pointer there is no method to get the size of an array. If passing the number of elements is unacceptable, consider passing a pointer or reference to a container class of CWeb rather than a pointer to CWeb.
TheShadow
TheShadow
I have seen methods with templates that work while you are not inside a class, there must be a method.
Mecha Engineer (Making Real Humanoid Suits)

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.