diff options
| author | Rye <rye@alchemyviewer.org> | 2026-01-10 04:54:16 -0500 |
|---|---|---|
| committer | Andrey Kleshchev <117672381+akleshchev@users.noreply.github.com> | 2026-01-21 22:07:08 +0200 |
| commit | 76a80b6787290dc8a950b43b67e5b4cd6238014f (patch) | |
| tree | 4289a5ae400d7007938a2809f70e2b7e14b0b4e4 /indra/llcommon/llstl.h | |
| parent | aad49bd41461269bc3294df73050a2dd4fc76fe1 (diff) | |
Replace usage of remaining boost::unordered containers with std
Replace LLUUID and LLMaterialID container hashing functions with more collision resistant versions
Utilize boost::hash_combine for TEMaterialPair to generate good hash distribution
Generalize is_in_map and get_if_there for usage with all mapped types
Diffstat (limited to 'indra/llcommon/llstl.h')
| -rw-r--r-- | indra/llcommon/llstl.h | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/indra/llcommon/llstl.h b/indra/llcommon/llstl.h index 7d41c42ba7..9f3587886c 100644 --- a/indra/llcommon/llstl.h +++ b/indra/llcommon/llstl.h @@ -229,12 +229,10 @@ void delete_and_clear_array(T*& ptr) template <typename T> inline typename T::mapped_type get_ptr_in_map(const T& inmap, typename T::key_type const& key) { - // Typedef here avoids warnings because of new c++ naming rules. - typedef typename T::const_iterator map_iter; - map_iter iter = inmap.find(key); + auto iter = inmap.find(key); if(iter == inmap.end()) { - return NULL; + return nullptr; } else { @@ -243,8 +241,8 @@ inline typename T::mapped_type get_ptr_in_map(const T& inmap, typename T::key_ty }; // helper function which returns true if key is in inmap. -template <typename K, typename T> -inline bool is_in_map(const std::map<K,T>& inmap, const K& key) +template <typename T> +inline bool is_in_map(const T& inmap, typename T::key_type const& key) { if(inmap.find(key) == inmap.end()) { @@ -260,12 +258,10 @@ inline bool is_in_map(const std::map<K,T>& inmap, const K& key) // To replace LLSkipMap getIfThere, use: // get_if_there(map, key, 0) // WARNING: Make sure default_value (generally 0) is not a valid map entry! -template <typename K, typename T> -inline T get_if_there(const std::map<K,T>& inmap, const K& key, T default_value) +template <typename T> +inline typename T::mapped_type get_if_there(const T& inmap, typename T::key_type const& key, typename T::mapped_type default_value) { - // Typedef here avoids warnings because of new c++ naming rules. - typedef typename std::map<K,T>::const_iterator map_iter; - map_iter iter = inmap.find(key); + auto iter = inmap.find(key); if(iter == inmap.end()) { return default_value; |
