Here's a working version of what I'm doing.
#include <memory>
using namespace std;
struct thing {
int blah;
};
struct parentObj {
parentObj(thing & incomingThing) : isThisOK(incomingThing) {};
thing & isThisOK;
};
int main()
{
shared_ptr<thing> thingInstance = make_shared<thing>();
shared_ptr<parentObj> theObj = make_shared<parentObj>(*thingInstance);
}
I like assigning a shared pointer to a reference of it's type. (ctrl+f isThisOK)
Are there unintended consequences here? Should I be using a weak pointer?