If I have a Y which has a member pointer to X, how can I make an instance of Y in X?
I thought about passing it somewhat like this:
#include <memory>
struct X;
struct Y 
{    
    Y(int n, std::shared_ptr<X> x) 
        : n_(n)
        , x_(x)
    {}
    std::shared_ptr<X> x_;
    int n_;
};
    
struct X 
{
    void d()
    {
        auto y = std::make_shared<Y>(20, this);
    } 
};
    
int main()
{
    return 0;
}
 
     
     
    