BLI: small optimization to retrieving CPPType from static type

This commit is contained in:
Jacques Lucke 2022-04-26 16:56:01 +02:00
parent e9334c5df8
commit 7b16ddeb5a
1 changed files with 3 additions and 1 deletions

View File

@ -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();