{
std::list<std::string> result;
for(ItemMap::const_iterator i=items.begin(); i!=items.end(); ++i)
- if(dynamic_cast<const Item<T> *>(i->second))
+ if(dynamic_cast<const Item<typename RemoveConst<T>::Type> *>(i->second))
result.push_back(i->first);
return result;
}
+ /**
+ Returns a list of objects of a specific type in the collection.
+ */
+ template<typename T>
+ std::list<T *> get_list() const
+ {
+ typedef typename RemoveConst<T>::Type NCT;
+
+ std::list<T *> result;
+ for(ItemMap::const_iterator i=items.begin(); i!=items.end(); ++i)
+ if(Item<NCT> *item=dynamic_cast<Item<NCT> *>(i->second))
+ result.push_back(item->data);
+ return result;
+ }
+
/**
Checks whether a name exists in the collection. Does not care about the
type of the object.