Collections also support a notion of "future objects". These are objects which
are known to be possible to load, but loading them is deferred to the first
time they are requested.
+
+Other classes are available to provide refined ways of loading objects from
+files. See DirectoryCollection and PackCollection.
*/
class Collection
{
if((*j)->can_create() && (*j)->check_type<NCT>())
(*j)->create_item(*this, name);
- return *get_item(items, name).value<RefPtr<NCT> >();
+ NCT *ptr = get_item(items, name).value<RefPtr<NCT> >().get();
+ if(!ptr)
+ throw key_error(typeid(ItemMap));
+ return *ptr;
}
template<typename T>