- typedef RefPtr<typename RemoveConst<T>::Type> RPNCT;
-
- ItemMap::iterator i = items.find(name);
- if(i!=items.end())
- {
- if(i->second.check_type<RPNCT>())
- {
- // Replace a future object placeholder
- RPNCT &ptr = i->second.value<RPNCT>();
- if(!ptr)
- {
- ptr = item;
- return;
- }
- }
-
- throw key_error(typeid(ItemMap));
- }
-
- items.insert(ItemMap::value_type(name, RPNCT(item)));
- }
-
-protected:
- /** Adds the name of a future object to the collection. The object itself
- will be loaded on first access. The calling subclass should be prepared to
- create the object on request. */
- template<typename T>
- void add_future(const std::string &name)
- {
- RefPtr<typename RemoveConst<T>::Type> ptr(0);
- insert_unique(items, name, ptr);