/* * Copyright 2009-2010, Pier Luigi Fiorini. All rights reserved. * Distributed under the terms of the MIT License. */ #ifndef _LIST_H #define _LIST_H #include #include template class List { public: uint32 CountItems() const; void AddItem(T type); void RemoveItemAt(uint32 position); TYPE ItemAt(uint32 position); private: std::list fList; typedef typename std::list::iterator fIter; }; template uint32 List::CountItems() const { return fList.size(); } template void List::AddItem(T type) { fList.push(type); } template void List::RemoveItemAt(uint32 position) { fIter i = fMap.begin(); std::advance(i, position); fList.erase(i); } template T List::ItemAt(uint32 position) { fIter i = fList.begin(); std::advance(i, position); if (i == fList.end()) return NULL; return i; } #endif // _LIST_H