Opened 9 years ago
Closed 9 years ago
#9386 closed Bugs (fixed)
Compilation error with polygon and multi_array
| Reported by: | Owned by: | Andrii Sydorchuk | |
|---|---|---|---|
| Milestone: | Boost 1.56.0 | Component: | polygon | 
| Version: | Boost 1.54.0 | Severity: | Problem | 
| Keywords: | polygon multi_array | Cc: | 
Description
With this piece of code:
#include <boost/multi_array.hpp>
#include <boost/polygon/polygon.hpp>
int main()
{
	typedef boost::polygon::polygon_45_with_holes_data<int> polygon;
	typedef boost::polygon::polygon_traits<polygon>::point_type point;
	
	point centroid;
	polygon poly;
	
	boost::polygon::center(c.centroid, c.poly);
}
If you include the headers in the following order:
#include <boost/multi_array.hpp> #include <boost/polygon/polygon.hpp>
..it breaks, if you reverse them it works:
#include <boost/polygon/polygon.hpp> #include <boost/multi_array.hpp>
Attachments (1)
Change History (7)
comment:1 by , 9 years ago
comment:2 by , 9 years ago
| Owner: | changed from to | 
|---|---|
| Status: | new → assigned | 
comment:3 by , 9 years ago
The problem here is with ADL (argument dependent lookup). The issues is explained with an example here: http://stackoverflow.com/questions/2958648/what-are-the-pitfalls-of-adl. From what I understood, there is no way to fix this permanently, as I can not rename the Boost.Polygon method because it's part of the public interface. The possible solution will be to use the following directive at the top of your file: #define BOOST_MULTI_ARRAY_NO_GENERATORS 1
comment:4 by , 9 years ago
| Resolution: | → wontfix | 
|---|---|
| Status: | assigned → closed | 
I am marking the issue as "wontfix", as it requires the changes to the C++ standard. Here is some additional reading from Dave Abrahams: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3490.html
comment:5 by , 9 years ago
| Milestone: | To Be Determined → Boost 1.56.0 | 
|---|---|
| Resolution: | wontfix | 
| Status: | closed → reopened | 
I've found the way to fix the issue by changing the order of method definitions inside the Polygon library. Please use the attached patch.
by , 9 years ago
comment:6 by , 9 years ago
| Resolution: | → fixed | 
|---|---|
| Status: | reopened → closed | 


The compilation error is:
/usr/local/include/boost/polygon/polygon_traits.hpp:1429:26: error: no match for call to ‘(boost::multi_array_types::extent_gen {aka boost::detail::multi_array::extent_gen<0ul>}) (boost::polygon::rectangle_data<int>&, const boost::polygon::polygon_45_with_holes_data<int>&)’