I have posted the full demonstration here: http://forum.kde.org/viewtopic.php?f=74&t=101773 but essentially this code: typedef std::vector<Eigen::Vector2d,Eigen::aligned_allocator<Eigen::Vector2d> > Point2DVector; Point2DVector points(5); compiles fine without the gnu++0x flag, but I get this error with that flag: error: no matching function for call to ‘Eigen::aligned_allocator<Eigen::Matrix<double, 2, 1> >::construct(Eigen::Matrix<double, 2, 1>*)’
Fixing this issue would require to add an overload like this one: template<typename... _Args> void construct(pointer p, _Args&&... __args) { ::new(p) _Tp(std::forward<_Args>(__args)...); } which is c++11 specific. So we would need a portable way to detect if c++11 is enabled. Does any one know a good solution for this?
What is supposed to work and be portable is to check whether (__cplusplus>=201103L) See here: http://sourceforge.net/apps/mediawiki/predef/index.php?title=Standards
(In reply to comment #2) > What is supposed to work and be portable is to check whether > (__cplusplus>=201103L) Which at least for gcc seems to work only starting from version 4.7, so you need to check at least for __GXX_EXPERIMENTAL_CXX0X__ as well: http://stackoverflow.com/questions/2958398/gnu-c-how-to-check-when-std-c0x-is-in-effect
thanks, I'm tempted to check for (__cplusplus>=201103L) only. It's not our business to support experimental compiler features. https://bitbucket.org/eigen/eigen/changeset/ad274b0ede15/ changeset: ad274b0ede15 user: ggael date: 2012-05-03 11:55:30 summary: bug 455: add support for c++11 in aligned_allocator
I would suggest defining a token such as EIGEN_CXX11_ENABLED in Macros.h if c++11 is available. That will make it easier to adapt in case the official way is not portable at all (has anyone checked MSVC for instance?) and also gives people an easier possibility to manually enable it, if they use gcc<4.7. I assume there will be more use cases in the future such as l-value references.
Yes that would be better. We could also check how Boost is dealing with that. They probably has good macros to detect each c++11 features.
-- GitLab Migration Automatic Message -- This bug has been migrated to gitlab.com's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.com/libeigen/eigen/issues/455.