[eigen] Eigen 3.3.0 compile error with aligned_allocator |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: "Eigen (eigen@xxxxxxxxxxxxxxxxxxx)" <eigen@xxxxxxxxxxxxxxxxxxx>
- Subject: [eigen] Eigen 3.3.0 compile error with aligned_allocator
- From: "Lodron, Gerald" <Gerald.Lodron@xxxxxxxxxxx>
- Date: Wed, 16 Nov 2016 07:38:37 +0000
- Accept-language: de-DE, en-US
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joanneum.at; s=sel6; t=1479281918; bh=242tOsVLj0ByDnWU9qlZLxYOXTfl7Idbt/CJtbCtK6A=; h=From:To:Subject:Date; b=0FZku17C2tckL8RbJLxO3bMxUbiRtpErnSdp4tH7Y0ap0TBqvz/Vt+vcu2sFbdTFS fTXM5Loq744OTJ7wy0PFAS8KghIy2wiqhffdV2InUjZKygF7OTEGCSd/K9PYkrQXqk CsuxpDgYkx0fvmn7NpUbWnofwDHQtMVvPRS7pk+Q=
- Thread-index: AdI/2/9Fw1t1AoZ5QZa1U8dc4HuM5w==
- Thread-topic: Eigen 3.3.0 compile error with aligned_allocator
Hi
I am compiling PCL trunk with Eigen3.3.0 (and VS2013x64, boost 1.62.0) and get a compilation error on the intantiation of
…
typedef boost::unordered_map<int, Leaf, boost::hash<int>, std::equal_to<int>, Eigen::aligned_allocator<int> > HashMap;
…
HashMap cell_hash_map_;
E:\Develop\Libraries120_x64\boost\1.62.0-NoPython\include\boost-1_62\boost/unordered/detail/allocate.hpp(497) : error C2664: 'Eigen::aligned_allocator<U>::aligned_allocator(const Eigen::aligned_allocator<U> &)' : cannot convert argument 1 from 'std::allocator<T>' to 'const Eigen::aligned_allocator<U> &'
with
[
U=boost::unordered::detail::ptr_node<std::pair<const int,pcl::GridProjection<pcl::PointNormal>::Leaf>>
]
and
[
T=boost::unordered::detail::ptr_node<std::pair<const int,pcl::GridProjection<pcl::PointNormal>::Leaf>>
]
and
[
U=boost::unordered::detail::ptr_node<std::pair<const int,pcl::GridProjection<pcl::PointNormal>::Leaf>>
]
Reason: cannot convert from 'std::allocator<T>' to 'const Eigen::aligned_allocator<U>'
I googled a little bit and found
http://stackoverflow.com/questions/16126133/compiling-issue-with-custom-allocators-when-std-c0x-is-enabled
“The error message actually contains the hint. I’ve reformulated it slightly here:
error: invalid operands [of type aligned_allocator<int>] to binary expression […] __x._M_get_Tp_allocator() == this->_M_get_Tp_allocator()
In other words, your allocator type needs to provide an operator ==.
This is part of the allocator requirements (§17.6.3.5, table 28). This has always been the case. But until C++11 allocators were stateless and operator == consequently always returned true, so the standard library containers probably never called the operator. This would explain why the code compiles without -std=++0x.
“
Could it be that you need some operator definitions in the aligned_allocator of eigen? The compilation error is only since eigen 3.2.9, on eigen 3.2.8 it works. The difference which causes the error is the inheritance from std::allocator of Eigen::aligned_allocator....