Why would you want to make a function for that, when the size() function already exists?
Here's a code example of size() using Salem's demo-code:
std::map <std::string, std::vector<std::string> > array;
array["fruit"].push_back( "apple" );
array["fruit"].push_back( "pear" );
cout << "The map 'array' has " << array.size() << " vector(s)\n";
cout << "The vector 'fruit' in map 'array' has "
<< array["fruit"].size() << " elements\n";
Last edited by Nick Evan; May 15th, 2008 at 3:52 am.
Moderator
Featured Poster
Reputation Points: 4142
Solved Threads: 394
Industrious Poster
Offline 4,132 posts
since Oct 2006