#include <stdio.h>
#include <stdlib.h>
#include <utility>

struct Foo
{
    Foo()
    {
        m_Bar = new int;
        *m_Bar = s_Baz++;
        printf("Ctor %8p %i\n", m_Bar, *m_Bar);
    }
    
    Foo(const Foo& other)
    {
        m_Bar = new int;
        *m_Bar = *(other.m_Bar);
        printf("Copy %8p %i\n", m_Bar, *m_Bar);
    }
    
    Foo(Foo&& other)
    {
        m_Bar = other.m_Bar;
        other.m_Bar = nullptr;
        printf("Move %8p %i\n", m_Bar, *m_Bar);
    }
    
    ~Foo()
    {
        printf("Dtor %8p\n", m_Bar);
        delete m_Bar;
    }

    int* m_Bar;
    static int s_Baz;
};

int Foo::s_Baz;

void DoFoo(Foo foo)
{
    printf("Foo  %8p %i\n", foo.m_Bar, *(foo.m_Bar));
}

int main()
{
    Foo foo;
    DoFoo(foo);
    DoFoo(Foo{});
    return 0;
}
