[Bf-blender-cvs] [f85ea4ae3cb] master: BLI: add non-const lookup methods for StringMap
Jacques Lucke
noreply at git.blender.org
Fri Sep 13 12:28:30 CEST 2019
Commit: f85ea4ae3cb991aa593f842496639720084f1277
Author: Jacques Lucke
Date: Fri Sep 13 12:28:19 2019 +0200
Branches: master
https://developer.blender.org/rBf85ea4ae3cb991aa593f842496639720084f1277
BLI: add non-const lookup methods for StringMap
===================================================================
M source/blender/blenlib/BLI_string_map.h
===================================================================
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.
More information about the Bf-blender-cvs
mailing list