인벤토리 기능을 구현하고 있는데 스마트포인터를 내가 제대로 이해한건지 잘 모르겠음
인벤토리는 현재 vector<vector<shared_ptr<Item>>> _items; 이차원 벡터로 가지고 있음

template<typename T>

bool Inventory::AddItem(shared_ptr<T> item)

{

    static_assert(is_convertible_v<shared_ptr<T>, shared_ptr<Item>>, "T must be derived from Item");


    shared_ptr<Item> emptySlot = nullptr;

const int itemIdx = item->GetItemTypeIndex();


    for (auto& slot : _items[itemIdx])

    {

        if (slot == item) 

        {

            slot->SetItemCount(slot->GetItemCount() + 1);

            return true;

        }


        if (!slot && !emptySlot)

            emptySlot = &slot;

    }


    if (emptySlot)

    {

        emptySlot = item;

        return true;

    }


return false;

}

인벤토리로 아이템을 추가할 때,

1. 이미 아이템을 가지고 있는가?
2. 빈 슬롯이 존재하는가?

위 2가지를 검사하고 추가하는 방향으로 잡았는데
auto& 이 부분을 참조로 하는게 맞는 것인지 잘 모르겠음...