proxygen
|
#include <Memory.h>
AllocatorHasDefaultObjectConstruct
AllocatorHasDefaultObjectConstruct<A, T, Args...> unambiguously inherits std::integral_constant<bool, V>, where V will be true iff the effect of std::allocator_traits<A>::construct(a, p, args...) is the same as new (static_cast<void*>(p)) T(args...). If true then any optimizations applicable to object construction (relying on std::is_trivially_copyable<T>, for example) can be applied to objects in an allocator-aware container using an allocation of type A.
Allocator types can override V by declaring a type alias for folly_has_default_object_construct. It is helpful to do this if you define a custom allocator type that defines a construct method, but that method doesn't do anything except call placement new.