Hi folks,

    I am trying to customize existing class IntVar by adding some more data
member into it. My current way is to subclass from IntVar (say the new class
name is MyIntVar) and write constructors and new member functions to
manipulate the new data. This works well.

However, if I want to use IntVarArray and IntVarArgs to hold MyIntVar, all
MyIntVar elements seems are converted to IntVar.

For example, in the code

MyIntVar myIntVar(*this, 0, 10);
IntVarArgs intVarArgs;
intVarArgs << myIntVar;

I observe that intVarArgs[0] is IntVar type. I can not even use dynamic_cast
to cast it to MyIntVar.

If I do it another way by implementing MyIntVarArray and MyIntVarArgs for
MyIntVar following the document "Modeling and Programming with Gecode" (this
corresponds to IntVarArray and IntVarArgs for IntVar), this works well. But
the problem is that constraints posting (e.g. sum, "+") do not work on new
MyIntVarArray and MyIntVarArgs.

Basically, my question is what is the easiest to way to slightly modify
IntVar to adapt to user needs.

Many thanks
-- 
--------------------------------------------
Changbin Liu
Computer & Information Science Department
University of Pennsylvania
Philadelphia, PA
U.S.
_______________________________________________
Gecode users mailing list
[email protected]
https://www.gecode.org/mailman/listinfo/gecode-users

Reply via email to