The following code can be compiled and run. I am wondering when the constructor of v
is called. Is it called before the constructor of A
is called? Also I am wondering whether the following code satisfies c++ standard.
#include <vector>
#include <iostream>
class A{
private:
std::vector<int> v;
public:
A(int b) { v.push_back(b); };
};
int main() {
A a(1);
return 0;
}