From 38d36e44927d56f45042fb5e11a342a3a7dd5daa Mon Sep 17 00:00:00 2001 From: Steven Moreland Date: Fri, 26 Apr 2024 21:08:48 +0000 Subject: [PATCH] libutils: T* is a trivial type Avoid calling constructors/destructors for each element, when we have Vector. These are used in libbinder and elsewhere. std::vector is still faster but uses more mem. Bugs: me Test: boot && binderLibTest Change-Id: Id1239daddd018f8eee5480d1cb6dd25d6f4df808 --- libutils/binder/include/utils/TypeHelpers.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libutils/binder/include/utils/TypeHelpers.h b/libutils/binder/include/utils/TypeHelpers.h index 1554f52ee..21d9b3db1 100644 --- a/libutils/binder/include/utils/TypeHelpers.h +++ b/libutils/binder/include/utils/TypeHelpers.h @@ -109,6 +109,11 @@ ANDROID_BASIC_TYPES_TRAITS( unsigned long long ) ANDROID_BASIC_TYPES_TRAITS( float ) ANDROID_BASIC_TYPES_TRAITS( double ) +template struct trait_trivial_ctor { enum { value = true }; }; +template struct trait_trivial_dtor { enum { value = true }; }; +template struct trait_trivial_copy { enum { value = true }; }; +template struct trait_trivial_move { enum { value = true }; }; + // ---------------------------------------------------------------------------