Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Viri-

std::vector <D3DDISPLAYMODE> DisplayModes;

This topic is 6252 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Ok I was looking at some code that I''ve been playing with and I saw this: std::vector DisplayModes; What does this mean? I''ve been told that its a vector template and thats cool and everything but how do I use it? What is the std part? In the rest of the code I can''t find any references to the std. Do I just need an include or what? Thanks, David

Share this post


Link to post
Share on other sites
Advertisement
well . std::vector belongs to the stl library.

std is the namespace used to group all the stl templates
togather.

  
#include <vector>

using namespace std;

vector<OBJECT> vcObject;

void func()
{
OBJECT myobject;
vcObject.push_back(myobject); // add to the back


vector<OBJECT>::iterator it;

for(it = vcObject.begin(); it!= vcObject.end(); it++)
cout << *it; // this will access OBJECTS in the vector


vcObjects.erase(vcObjects.begin(),vcObjects.end()); // clear

}





{ Stating the obvious never helped any situation !! }

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!