Eigen::aligned_allocator fails with std::unordered_multimap

烂漫一生 提交于 2021-02-19 00:37:55

问题


I am trying to compile this code in XCode 6:

std::unordered_multimap< Frame*, Sim3, std::hash<Frame*>, std::equal_to<Frame*>, Eigen::aligned_allocator< std::pair<const Frame*,Sim3> > > trackingFailed;

It fails with:

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/unordered_map:1461:5: Static_assert failed "Invalid allocator::value_type"

Is it still necessary to use aligned_allocator in Eigen 3.2.2? Why is it failing with C++11/C++14 and libc++?

EDIT:

I get no type named value_type if I remove the Eigen allocator from the unordered_map template declaration.


回答1:


I believe the mistake is that the pointer should be const, not the pointee.
I.e. try Eigen::aligned_allocator< std::pair<Frame* const, Sim3> > as the allocator type.



来源:https://stackoverflow.com/questions/27336941/eigenaligned-allocator-fails-with-stdunordered-multimap

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!