Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorJacques Lucke <mail@jlucke.com>2019-09-13 13:28:19 +0300
committerJacques Lucke <mail@jlucke.com>2019-09-13 13:28:19 +0300
commitf85ea4ae3cb991aa593f842496639720084f1277 (patch)
treee8c9a9f6f828f674fce3faf745424ae26ec9c46a /source
parent08539312b24b7f0a9a5334e85b9d5c5b532b6453 (diff)
BLI: add non-const lookup methods for StringMap
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenlib/BLI_string_map.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_string_map.h b/source/blender/blenlib/BLI_string_map.h
index 0cf0bb40e4d..e7eb1e2635e 100644
--- a/source/blender/blenlib/BLI_string_map.h
+++ b/source/blender/blenlib/BLI_string_map.h
@@ -248,6 +248,11 @@ template<typename T, typename Allocator = GuardedAllocator> class StringMap {
ITER_SLOTS_END(offset);
}
+ T &lookup(StringRef key)
+ {
+ return const_cast<T &>(const_cast<const StringMap *>(this)->lookup(key));
+ }
+
/**
* Get a pointer to the value corresponding to the key. Return nullptr, if the key does not
* exist.
@@ -266,6 +271,11 @@ template<typename T, typename Allocator = GuardedAllocator> class StringMap {
ITER_SLOTS_END(offset);
}
+ T *lookup_ptr(StringRef key)
+ {
+ return const_cast<T *>(const_cast<const StringMap *>(this)->lookup_ptr(key));
+ }
+
/**
* Get a copy of the value corresponding to the key. If the key does not exist, return the
* default value.