- /** Checks whether a name exists in the collection. Does not care about the
- type of the object. */
- bool contains(const std::string &n) const;
+ /// Checks whether a typed object exists in the collection.
+ template<typename T>
+ bool contains(const std::string &name) const
+ {
+ ItemMap::const_iterator i = items.find(name);
+ if(i==items.end())
+ return false;
+
+ return i->second.check_type<typename RemoveConst<T>::Type>();
+ }