Quantcast
Channel: beginners - openFrameworks
Viewing all articles
Browse latest Browse all 4929

Vector init and for loop in C++11

$
0
0

@Gallo wrote:

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

Posts: 4

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 4929

Trending Articles