[gecode-users] wrapping SetVar
Guido Tack
tack at ps.uni-sb.de
Wed Feb 7 05:04:42 CET 2007
Hi!
> Now I need to create a SetView from my SetVar, in order
> to access its lub with LubRanges.
You do not have to use pointers to views, just use the views
directly. They are themselves just thin wrappers around a pointer to
the actual variable implementation. Allocating a view on the stack
costs exactly the same as allocating a pointer variable. If you
really want to use pointers, you could consider using the pointer
returned by SetView::variable(void).
> // this function could be called something like
> // LubRanges_from_SetVar
> {
> ...
> SetVar* set;
> SetView view(*set);
> return new LubRanges ranges(view); // (this would not work I
> suppose....)
> }
This will work!
> What do you suggest? Can I somehow override that new is private?
No, please don't.
Cheers,
Guido
More information about the gecode-users
mailing list