diff options
author | Nat Goodspeed <nat@lindenlab.com> | 2011-02-01 20:18:01 -0500 |
---|---|---|
committer | Nat Goodspeed <nat@lindenlab.com> | 2011-02-01 20:18:01 -0500 |
commit | 6dcbbaeb230a0e6c54b56905728e4ab7fe459fba (patch) | |
tree | 8dc53ec1fc7d859c1a6fcf2535689771ccc5c7a2 /indra/llcommon/lleventdispatcher.cpp | |
parent | 409c59b70d2d4f2958ccd3ee8db5f7e6e08fe14e (diff) |
Replace boost::ptr_map<name, etc> with std::map<name, shared_ptr>.
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.
Diffstat (limited to 'indra/llcommon/lleventdispatcher.cpp')
-rw-r--r-- | indra/llcommon/lleventdispatcher.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
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<DispatchEntry>( - 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<DispatchEntry>( - 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<DispatchEntry>( - 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 |