How does one suppress the automatic initialization and destruction of a type? While it is wonderful that T buffer[100] automatically initializes all the elemen
This code:
#include
#include
using namespace std;
int created = 0, destroyed = 0;
struct S
{
S()
{
++created;
}
S(const S & s ) {
++created;
}
~S()
{
++destroyed;
}
};
int main()
{
{
std::vector vec;
vec.reserve(50);
}
std::cout << "Created:\t" << created << std::endl;
std::cout << "Destroyed:\t" << destroyed << std::endl;
return 0;
}
has exactly the output you want - I'm not sure what your question is.