parent
f4ceb81c4f
commit
686379839e
@ -0,0 +1,20 @@ |
||||
#include <vector> |
||||
#include <iostream> |
||||
|
||||
class MyClass{ |
||||
public: |
||||
int val=0; |
||||
MyClass(int val) |
||||
:val(val){}; |
||||
}; |
||||
|
||||
int main() { |
||||
std::vector<MyClass> myitems; |
||||
for (int i=0;i<20;i++) { |
||||
myitems.push_back({i}); |
||||
} |
||||
for (int i=0;i<myitems.size();i++) { |
||||
(&myitems[i])->val++; |
||||
std::cout<<myitems[i].val<<"\n"; |
||||
} |
||||
} |
Loading…
Reference in new issue