libutils: T* is a trivial type

Avoid calling constructors/destructors for
each element, when we have Vector<T*>. These
are used in libbinder and elsewhere.

std::vector is still faster but uses more mem.

Bugs: me
Test: boot && binderLibTest
Change-Id: Id1239daddd018f8eee5480d1cb6dd25d6f4df808
This commit is contained in:
Steven Moreland 2024-04-26 21:08:48 +00:00
parent 6d6ff398b3
commit 38d36e4492

View file

@ -109,6 +109,11 @@ ANDROID_BASIC_TYPES_TRAITS( unsigned long long )
ANDROID_BASIC_TYPES_TRAITS( float )
ANDROID_BASIC_TYPES_TRAITS( double )
template<typename T> struct trait_trivial_ctor<T*> { enum { value = true }; };
template<typename T> struct trait_trivial_dtor<T*> { enum { value = true }; };
template<typename T> struct trait_trivial_copy<T*> { enum { value = true }; };
template<typename T> struct trait_trivial_move<T*> { enum { value = true }; };
// ---------------------------------------------------------------------------