[Bf-blender-cvs] [7b16ddeb5a0] master: BLI: small optimization to retrieving CPPType from static type
Jacques Lucke
noreply at git.blender.org
Tue Apr 26 16:56:40 CEST 2022
Commit: 7b16ddeb5a02d14e236c71673f21d1a99e275364
Author: Jacques Lucke
Date: Tue Apr 26 16:56:01 2022 +0200
Branches: master
https://developer.blender.org/rB7b16ddeb5a02d14e236c71673f21d1a99e275364
BLI: small optimization to retrieving CPPType from static type
===================================================================
M source/blender/blenlib/BLI_cpp_type.hh
===================================================================
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();
More information about the Bf-blender-cvs
mailing list