Hello Kris,

Thank you very much for your assistance. 

I will give it try, although this issue became somehow obsolete since I wanted to store the "CGAL::Polygon_2" in shared memory. I noticed that this is not even possible with CGAL::Vector_2, so I have to think about something completely different.

Many thanks and best regards

Jupp Tscheak

Am 19.07.2013 um 21:52 schrieb Krzysztof Czainski:

2013/7/19 Jupp Tscheak <jupp.tscheak@gmx.de>
Hello boost users,
Please consider the following example:

[code]
#include "CGAL/Cartesian.h"
#include "CGAL/Polygon_2.h"

#include "boost/container/static_vector.hpp"

typedef CGAL::Cartesian<double> Kernel;
typedef Kernel::Point_2 Point2d;
typedef CGAL::Polygon_2<Kernel, boost::container::static_vector<Point2d, 100> > Polygon2d;

Polygon2d p;
p = Polygon2d();
[/code]

Compiling this code snippet with GCC results in following error message:

[error]
error: no match for 'operator=' in 'p = CGAL::Polygon_2<CGAL::Cartesian<double>, boost::container::static_vector<CGAL::Point_2<CGAL::Cartesian<double> >, 100u> >((*(const Traits*)(& CGAL::Polygon_2<CGAL::Cartesian<double>, boost::container::static_vector<CGAL::Point_2<CGAL::Cartesian<double> >, 100u> >::Traits())))'
note: candidate is:
CGAL-4.2/include/CGAL/Polygon_2.h:68:7: note: CGAL::Polygon_2<CGAL::Cartesian<double>, boost::container::static_vector<CGAL::Point_2<CGAL::Cartesian<double> >, 100u> >& CGAL::Polygon_2<CGAL::Cartesian<double>, boost::container::static_vector<CGAL::Point_2<CGAL::Cartesian<double> >, 100u> >::operator=(CGAL::Polygon_2<CGAL::Cartesian<double>, boost::container::static_vector<CGAL::Point_2<CGAL::Cartesian<double> >, 100u> >&)
CGAL-4.2/include/CGAL/Polygon_2.h:68:7: note: no known conversion for argument 1 from 'sensor::Polygon2d {aka CGAL::Polygon_2<CGAL::Cartesian<double>, boost::container::static_vector<CGAL::Point_2<CGAL::Cartesian<double> >, 100u> >}' to 'CGAL::Polygon_2<CGAL::Cartesian<double>, boost::container::static_vector<CGAL::Point_2<CGAL::Cartesian<double> >, 100u> >&'
[/error]

I apologize for this concrete example using CGAL, but maybe someone has advice for me?

Hello Jupp,

I don't know anything about CGAL, but I have a guess for you, where I assume you're *not* in C++11 mode. I think I saw a similar error with my structures and mingw-4.7. Please see this example (warning: it's out of my head, not tested):

struct X
{
  static_vector<int,3> v;
};

int main()
{
  X x, y;
  x = y; // similar compile error
}
 
 If you get a similar error compiling the example above, I believe I can explain it. I looks to me like the fault of move emulation in static_vector. I'm not sure if it's a bug in static_vector, or if that's the cost of using Boost.Move, but I remember writing my own operator= in struct X helped:

struct X
{
  static_vector<int,3> v;
  X& operator=( X const& x ) { v = x.v; return *this; }
};

I think this is needed, because due to using Boost.Move in emulation mode static_vector defines
static_vector& operator=(static_vector&); // note: non-const arg
so the auto-generated operaotr= in X also takes a non-const

HTH,
Kris
_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users