Just a quick question. In this example:
is the constructor of MyClass called 10 times (assuming it has a default constructor)? or only the memory is allocated?Code:int main() { MyClass a[10]; }
How about something like this:
If the constructors are called, wouldn't that make the allocation of an array and construction of the vector O(n)? (assuming the constructor itself is O(1) ).Code:int main() { std::vector<MyClass> v(10); }
Thank you