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
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2022-04-26 17:56:01 +0300
committerJacques Lucke <jacques@blender.org>2022-04-26 17:56:21 +0300
commit7b16ddeb5a02d14e236c71673f21d1a99e275364 (patch)
tree35bc6949949b1578effdb592873c445d26ce8023
parente9334c5df8b9c0c22c1c0ad20a087b5a437dcd23 (diff)
BLI: small optimization to retrieving CPPType from static type
-rw-r--r--source/blender/blenlib/BLI_cpp_type.hh4
1 files changed, 3 insertions, 1 deletions
diff --git a/source/blender/blenlib/BLI_cpp_type.hh b/source/blender/blenlib/BLI_cpp_type.hh
index dd14cca7a0b..ed680214602 100644
--- a/source/blender/blenlib/BLI_cpp_type.hh
+++ b/source/blender/blenlib/BLI_cpp_type.hh
@@ -172,7 +172,9 @@ class CPPType : NonCopyable, NonMovable {
*/
template<typename T> static const CPPType &get()
{
- return CPPType::get_impl<std::remove_cv_t<T>>();
+ /* Store the #CPPType locally to avoid making the function call in most cases. */
+ static const CPPType &type = CPPType::get_impl<std::remove_cv_t<T>>();
+ return type;
}
template<typename T> static const CPPType &get_impl();