Boost logo

Boost :

Subject: [boost] [Polygon] "Ambiguous use of partial specialization" in CodeWarrior
From: Kef Schecter (furrykef_at_[hidden])
Date: 2010-01-08 01:28:19

I'm using a special version of CodeWarrior for an embedded system, but I
suspect that other versions of the software will show the problem. The
problem is, basically, the compiler hates polygon_traits<T>. Here's an
example from polygon_90_set_traits.hpp:

   template <typename T>
   struct traits_by_concept<T, polygon_90_concept> {
     typedef polygon_traits<T> type;

It chokes on the typedef, saying "Ambiguous use of partial
specialization". This is the complete text of the error message; it
provides no other information.

Most of the surrounding definitions are very similar, but only the ones
that use polygon_traits<T> -- instead of, say, rectangle_traits<T> --
raise errors.

Here's another example from polygon_traits.hpp:

   template <typename T>
   struct view_of<rectangle_concept, T> {
     typedef typename polygon_traits<T>::coordinate_type coordinate_type;

It chokes on the typedef and any code that tries to use the typedef. The
same problem happens with all the other view_of functions and a couple
of others, but all the problems seem to deal with the use of
polygon_traits<T> in a template.

Unfortunately, I know very little about partial specialization, traits
classes, or any advanced features of generic programming in C++. My
understanding of templates is limited to stuff like making basic
containers, generalized sorting functions, etc. -- the easy stuff. So I
find the definition of polygon_traits too complicated and am unable to
fully comprehend the essence of the problem, let alone how to fix or
work around it.

Since I need to get this to work, if a proper solution is not obvious,
I'm willing to accept any kind of clumsy hack, including disabling parts
of the library that I might not need. (I use very little of the Polygon
library, but I have a hard time finding an alternative to the part I do
use -- namely, finding the union of polygons while allowing for holes.
Alternative suggestions in that area are welcome, but I can't use GPLed
code, or code that I would need to pay a license for to use commercially.)

Any ideas?

- Kef

Boost list run by bdawes at, gregod at, cpdaniel at, john at