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
diff --git a/libutils/binder/include/utils/TypeHelpers.h b/libutils/binder/include/utils/TypeHelpers.h
index 1554f52..21d9b3d 100644
--- a/libutils/binder/include/utils/TypeHelpers.h
+++ b/libutils/binder/include/utils/TypeHelpers.h
@@ -109,6 +109,11 @@
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 }; };
+
// ---------------------------------------------------------------------------