c++ - Why is the push_back method of vector not working? -


i want put in elements in vector. till date have used way of inserting elements in vector , has worked. not know why not working today.

world::world() {     collisionmap.loadfromfile("collisionmap.png");     for(int i=0; i<collisionmap.getsize().y; i++)     {         for(int j=0; j<collisionmap.getsize().x; j++)         {             if(collisionmap.getpixel(j,i)==sf::color(0,0,0))             {                   cout<<"test"<<endl //prints                   collisionlist.push_back(sf::floatrect(j*32, i*32, 32, 32));             }         }     }     cout<<collisionlist.size(); //shows nothing } 

edit:

i forgot mention :-

1.i using sfml.

2.collisionlist vector.

3.this code compiles without problem.

4.the size of collisionmap not 0 since collisionmap.getsize() returns accurate value.

cout<<collisionlist.size(); //shows nothing 

of course. puts stuff in buffer, doesn't output anything. try:

cout<<collisionlist.size()<<endl; 

Comments

Popular posts from this blog

php - Zend Framework / Skeleton-Application / Composer install issue -

c# - Better 64-bit byte array hash -

python - PyCharm Type error Message -