diff options
author | Martinho Fernandes <martinho.fernandes@gmail.com> | 2014-01-10 11:02:11 +0100 |
---|---|---|
committer | Martinho Fernandes <martinho.fernandes@gmail.com> | 2014-01-10 11:02:11 +0100 |
commit | 3a4616d6e3d7d60af5ba569b0d36e954d45a6fb9 (patch) | |
tree | e51fa40eb88aa02037e84742960a32c024515141 /Eigen/src/Core/util/Memory.h | |
parent | 276801b25a22ec2fed2bb13d217471e6098aea05 (diff) |
Add C++11 allocator overloads to avoid implicit conversions.
Diffstat (limited to 'Eigen/src/Core/util/Memory.h')
-rw-r--r-- | Eigen/src/Core/util/Memory.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Eigen/src/Core/util/Memory.h b/Eigen/src/Core/util/Memory.h index d177e8b5a..c1050e1ea 100644 --- a/Eigen/src/Core/util/Memory.h +++ b/Eigen/src/Core/util/Memory.h @@ -761,11 +761,27 @@ public: ::new( p ) T( value ); } +#if (__cplusplus >= 201103L) + template <typename U, typename... Args> + void construct( U* u, Args&&... args) + { + ::new( u ) U( std::forward<Args>( args )... ); + } +#endif + void destroy( pointer p ) { p->~T(); } +#if (__cplusplus >= 201103L) + template <typename U> + void destroy( U* u ) + { + u->~U(); + } +#endif + void deallocate( pointer p, size_type /*num*/ ) { internal::aligned_free( p ); |