7 #include "CallbackCollection.h"
18 std::vector<T> m_items;
23 size_t size()
const {
return m_items.size(); }
27 m_items.push_back(item);
28 m_itemAddedCallbacks.ExecuteCallbacks(item);
31 void RemoveItem(T& item)
33 m_items.erase(std::remove(m_items.begin(), m_items.end(), item), m_items.end());
34 m_itemRemovedCallbacks.ExecuteCallbacks(item);
37 T& operator[] (
size_t index)
44 Eegeo_ASSERT(index >= 0 && index < m_items.size());
45 return m_items.at(index);
48 const T& atConst(
size_t index)
const
50 Eegeo_ASSERT(index >= 0 && index < m_items.size());
51 return m_items.at(index);
56 m_itemAddedCallbacks.AddCallback(callback);
61 m_itemAddedCallbacks.RemoveCallback(callback);
66 m_itemRemovedCallbacks.AddCallback(callback);
71 m_itemRemovedCallbacks.RemoveCallback(callback);