[gecode-users] initialize ViewArray<IntView> from IntVarArray

Christian Schulte cschulte at kth.se
Wed Mar 13 17:24:30 CET 2013


Do all your arrays have size 4 (as in your loop)? ;-)

Christian

--
Christian Schulte, Professor of Computer Science, KTH,
www.ict.kth.se/~cschulte/


-----Original Message-----
From: users-bounces at gecode.org [mailto:users-bounces at gecode.org] On Behalf
Of Pascal Francq (Mailing lists)
Sent: Wednesday, March 13, 2013 4:58 PM
To: users at gecode.org
Subject: [gecode-users] initialize ViewArray<IntView> from IntVarArray

Hi,
I am developing a propagator which constructors takes an IntVarArray as
parameter, and I want to initialize a ViewArray on this parameter.
My current code looks like :

class MyPropagator :  public Propagator
{
	ViewArray<IntView> C;
	MyPropagator(Home home,IntVarArray& c)
		: Propagator(home), C(home,c.size())
	{
		for(size_t j=0;j<4;j++)
			C[j]=IntView(c[j]);
		C.subscribe(home,*this,PC_GEN_ASSIGNED);
	}
};

When I run the code, I have segmentation fault. I suppose that my
constructor is not correct.
Thanks.
--
Dr. Pascal Francq
Belgium

_______________________________________________
Gecode users mailing list
users at gecode.org
https://www.gecode.org/mailman/listinfo/gecode-users




More information about the users mailing list