diff options
author | Jacques Lucke <jacques@blender.org> | 2022-04-26 17:56:01 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2022-04-26 17:56:21 +0300 |
commit | 7b16ddeb5a02d14e236c71673f21d1a99e275364 (patch) | |
tree | 35bc6949949b1578effdb592873c445d26ce8023 /source/blender/blenlib/BLI_cpp_type.hh | |
parent | e9334c5df8b9c0c22c1c0ad20a087b5a437dcd23 (diff) |
BLI: small optimization to retrieving CPPType from static type
Diffstat (limited to 'source/blender/blenlib/BLI_cpp_type.hh')
-rw-r--r-- | source/blender/blenlib/BLI_cpp_type.hh | 4 |
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(); |