[Gecode] Copy versus update...

Christian Schulte schulte at imit.kth.se
Tue May 31 18:06:24 CEST 2005


Dear all,

one reason why Gecode did not compile with GCC 4.0 was that copying arrays
and variables was modelled by a function returning a copy. The problem was
that this required copy constructors which by themselves required copy
constructors which by themselves required copy constructors... This problem
was hacked up by some bizarre overloading which just happened to work for
MSVC and GCC 3.*.

I changed that: instead of c=x.copy(home) returning a copy c of an object x,
one has to use c.update(home,x). This avoids all the copy constructor
hassel. However, to make it work c now needs a default constructor.

And voila, now Gecode compiles with GCC 4.0. I just tried a couple of
examples and it appears as if the code is _really MUCH MUCH faster_ than
3.*.

Cheers
Christian

--
Christian Schulte, http://www.imit.kth.se/~schulte/ 





More information about the gecode-users mailing list