46 #include <pcl/type_traits.h>
47 #include <pcl/pcl_config.h>
52 #include <type_traits>
55 #if !defined(PCL_SILENCE_MALLOC_WARNING)
56 #if PCL_USES_EIGEN_HANDMADE_ALIGNED_MALLOC
59 #if (defined(EIGEN_DEFAULT_ALIGN_BYTES) && EIGEN_DEFAULT_ALIGN_BYTES==0) || (defined(EIGEN_MALLOC_ALREADY_ALIGNED) && EIGEN_MALLOC_ALREADY_ALIGNED)
61 #error "Potential runtime error due to aligned malloc mismatch! You likely have to compile your code with AVX enabled or define EIGEN_MAX_ALIGN_BYTES=32 (to silence this message at your own risk, define PCL_SILENCE_MALLOC_WARNING=1)"
63 #warning "Potential runtime error due to aligned malloc mismatch! You likely have to compile your code with AVX enabled or define EIGEN_MAX_ALIGN_BYTES=32 (to silence this message at your own risk, define PCL_SILENCE_MALLOC_WARNING=1)"
67 #if (defined(EIGEN_DEFAULT_ALIGN_BYTES) && EIGEN_DEFAULT_ALIGN_BYTES!=0) && (defined(EIGEN_MALLOC_ALREADY_ALIGNED) && !EIGEN_MALLOC_ALREADY_ALIGNED)
69 #error "Potential runtime error due to aligned malloc mismatch! PCL was likely compiled without AVX support but you enabled AVX for your code (to silence this message at your own risk, define PCL_SILENCE_MALLOC_WARNING=1)"
71 #warning "Potential runtime error due to aligned malloc mismatch! PCL was likely compiled without AVX support but you enabled AVX for your code (to silence this message at your own risk, define PCL_SILENCE_MALLOC_WARNING=1)"
86 #define PCL_MAKE_ALIGNED_OPERATOR_NEW \
87 EIGEN_MAKE_ALIGNED_OPERATOR_NEW \
88 using _custom_allocator_type_trait = void;
100 using std::shared_ptr;
110 using std::dynamic_pointer_cast;
113 using std::static_pointer_cast;
133 template<
typename T,
typename ... Args>
138 template<
typename T,
typename ... Args>
139 std::enable_if_t<has_custom_allocator<T>::value, shared_ptr<T>>
make_shared(Args&&... args)
141 return std::allocate_shared<T>(Eigen::aligned_allocator<T>(), std::forward<Args> (args)...);
144 template<
typename T,
typename ... Args>
145 std::enable_if_t<!has_custom_allocator<T>::value, shared_ptr<T>>
make_shared(Args&&... args)
147 return std::make_shared<T>(std::forward<Args> (args)...);
shared_ptr< T > make_shared(Args &&... args)
Returns a pcl::shared_ptr compliant with type T's allocation policy.