You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
356 B
20 lines
356 B
#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";
|
|
}
|
|
} |