Address Frank's comments
parent
693253f376
commit
eab53f69de
|
@ -17,28 +17,28 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <boost/make_shared.hpp>
|
||||
#include <gtsam/base/types.h>
|
||||
|
||||
#include <boost/type_traits.hpp>
|
||||
|
||||
#include <Eigen/Core>
|
||||
|
||||
#include <boost/make_shared.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
|
||||
|
||||
namespace gtsam {
|
||||
|
||||
/**
|
||||
* And our own `make_shared` as a layer of wrapping on `boost::make_shared`
|
||||
*/
|
||||
/// Add our own `make_shared` as a layer of wrapping on `boost::make_shared`
|
||||
template<typename T, typename ... Args>
|
||||
boost::enable_if_t<has_custom_allocator<T>::value, boost::shared_ptr<T>> make_shared(Args&&... args)
|
||||
{
|
||||
return boost::allocate_shared<T>(Eigen::aligned_allocator<T>(), std::forward<Args> (args)...);
|
||||
}
|
||||
|
||||
/// Fall back to the boost version if no need for alignment
|
||||
template<typename T, typename ... Args>
|
||||
boost::enable_if_t<!has_custom_allocator<T>::value, boost::shared_ptr<T>> make_shared(Args&&... args)
|
||||
{
|
||||
return boost::make_shared<T>(std::forward<Args> (args)...);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue