Quantcast
Channel: openFrameworks - Latest posts
Viewing all articles
Browse latest Browse all 40524

Vector init and for loop in C++11

$
0
0

hello,

i am just converting to C++11 new conventions with oF09

i am trying to get familiar with the for loop syntax with auto

i used to do :

vector<particle> particles;
for (int i = 0; i < 20 ; i ++) {
    particles.push_back(particle());
    particles.back().setup(posX, posY, width, heiht);
}

i can't figure out how to do the same with

for ( auto p : particles) {
...
}

thank you


Viewing all articles
Browse latest Browse all 40524

Trending Articles