+ /**
+ Returns the name of an item in the collection.
+ */
+ template<typename T>
+ const std::string &get_name(T *d) const
+ {
+ typedef typename RemoveConst<T>::Type NCT;
+
+ for(ItemMap::const_iterator i=items.begin(); i!=items.end(); ++i)
+ if(Item<NCT> *item=dynamic_cast<Item<NCT> *>(i->second))
+ if(item->data==d)
+ return i->first;
+
+ throw KeyError("Item not found in collection");
+ }
+