Member objects, unless dynamically allocated memory, are safe from this point of view. So, no, you don't need to wrap it in a smart pointer.
Specifically fooInBar
, being it a subobject of Bar
, it will be destroyed automatically by the destructor of Bar
. The same goes for fooInt
in Foo
.
And finally, unless you really need dynamic memory, you can also avoid the use of smart pointers in the first place:
int _tmain(int argc, _TCHAR* argv[])
{
Bar myBar;
}