Address Frank's comments
parent
693253f376
commit
eab53f69de
|
@ -17,24 +17,24 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <boost/make_shared.hpp>
|
|
||||||
#include <gtsam/base/types.h>
|
#include <gtsam/base/types.h>
|
||||||
|
|
||||||
#include <boost/type_traits.hpp>
|
|
||||||
|
|
||||||
#include <Eigen/Core>
|
#include <Eigen/Core>
|
||||||
|
|
||||||
|
#include <boost/make_shared.hpp>
|
||||||
|
#include <boost/utility/enable_if.hpp>
|
||||||
|
|
||||||
|
|
||||||
namespace gtsam {
|
namespace gtsam {
|
||||||
|
|
||||||
/**
|
/// Add our own `make_shared` as a layer of wrapping on `boost::make_shared`
|
||||||
* And our own `make_shared` as a layer of wrapping on `boost::make_shared`
|
|
||||||
*/
|
|
||||||
template<typename T, typename ... Args>
|
template<typename T, typename ... Args>
|
||||||
boost::enable_if_t<has_custom_allocator<T>::value, boost::shared_ptr<T>> make_shared(Args&&... 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)...);
|
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>
|
template<typename T, typename ... Args>
|
||||||
boost::enable_if_t<!has_custom_allocator<T>::value, boost::shared_ptr<T>> make_shared(Args&&... args)
|
boost::enable_if_t<!has_custom_allocator<T>::value, boost::shared_ptr<T>> make_shared(Args&&... args)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue