Take an ordinary struct (or class) with Plain Old Data types and objects as members. Note that there is no default constructor defined.
std::cout << f.x << " " << f.y << " " << f.z << f.str << std::endl;
shared_ptr<Foo> spFoo = make_shared<Foo>();
cout << spFoo->x << " " << spFoo->y << " " << spFoo->z << spFoo->str << endl;
If you see e.g. this
std::make_shared reference you will see that
The object is constructed as if by the expression
::new (pv) T(std::forward<Args>(args)...), where
pvis an internal
void*pointer to storage suitable to hold an object of type
std::make_shared<Foo>() basically does
new Foo(). That is, it value initializes the structure which leads to the zeroing of the non-class member variables.