From 6dcbbaeb230a0e6c54b56905728e4ab7fe459fba Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Tue, 1 Feb 2011 20:18:01 -0500 Subject: Replace boost::ptr_map with std::map. On Windows, unlike on Mac or Linux, boost::ptr_map<> started insisting on this concept of clonability. In other words, it wants to own a unique instance of the pointee; if you copy a value_type -- even to dereference an iterator! -- it wants to construct a whole new instance of the mapped_type. That's nuts. A std::map<..., boost::shared_ptr<>> has the property I want (the mapped_type goes away when the entry is erased), plus it's willing to pass around the shared_ptr to the same instance of the mapped_type. This change also permits simplifying a couple awkward kludges I'd already had to make to accommodate ptr_map's idiosyncracies. --- indra/llcommon/lleventdispatcher.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'indra/llcommon/lleventdispatcher.cpp') diff --git a/indra/llcommon/lleventdispatcher.cpp b/indra/llcommon/lleventdispatcher.cpp index e00cca366f..52660105c4 100644 --- a/indra/llcommon/lleventdispatcher.cpp +++ b/indra/llcommon/lleventdispatcher.cpp @@ -524,9 +524,9 @@ void LLEventDispatcher::addArrayParamsDispatchEntry(const std::string& name, const invoker_function& invoker, LLSD::Integer arity) { - // Peculiar to me that boost::ptr_map() accepts std::auto_ptr but not dumb ptr - mDispatch.insert(name, std::auto_ptr( - new ArrayParamsDispatchEntry(desc, invoker, arity))); + mDispatch.insert( + DispatchMap::value_type(name, DispatchMap::mapped_type( + new ArrayParamsDispatchEntry(desc, invoker, arity)))); } void LLEventDispatcher::addMapParamsDispatchEntry(const std::string& name, @@ -535,16 +535,18 @@ void LLEventDispatcher::addMapParamsDispatchEntry(const std::string& name, const LLSD& params, const LLSD& defaults) { - mDispatch.insert(name, std::auto_ptr( - new MapParamsDispatchEntry(name, desc, invoker, params, defaults))); + mDispatch.insert( + DispatchMap::value_type(name, DispatchMap::mapped_type( + new MapParamsDispatchEntry(name, desc, invoker, params, defaults)))); } /// Register a callable by name void LLEventDispatcher::add(const std::string& name, const std::string& desc, const Callable& callable, const LLSD& required) { - mDispatch.insert(name, std::auto_ptr( - new LLSDDispatchEntry(desc, callable, required))); + mDispatch.insert( + DispatchMap::value_type(name, DispatchMap::mapped_type( + new LLSDDispatchEntry(desc, callable, required)))); } void LLEventDispatcher::addFail(const std::string& name, const std::string& classname) const -- cgit v1.2.3