In fact, the IntVarArray had 5 elements (a bug in another part of the
program). Therefore, one element wasn't initialized and produced the
segmentation fault.
What a stupid error I should have verify this before sending the email.
Sorry and thanks.

Le 13/03/13 17:24, Christian Schulte a écrit :
> 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: [email protected] [mailto:[email protected]] On Behalf
> Of Pascal Francq (Mailing lists)
> Sent: Wednesday, March 13, 2013 4:58 PM
> To: [email protected]
> 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
> [email protected]
> https://www.gecode.org/mailman/listinfo/gecode-users
> 


-- 
Dr. Pascal Francq
Belgium

_______________________________________________
Gecode users mailing list
[email protected]
https://www.gecode.org/mailman/listinfo/gecode-users

Reply via email to