Hi,


what’s wrong with creating a new array each time you need it? They are very
fast to create (they will only allocate heap memory if the array is large
and otherwise, creation is super-quick). I have to admit I still don’t see
really what you mean by uncertain number.



Best

Christian



From: Kayler Yao [mailto:[email protected]]
Sent: Saturday, August 29, 2009 5:23 PM
To: Christian Schulte
Cc: [email protected]
Subject: Re: [gecode-users] help --- how to create an object dynamically in
Gecode?



hi,

   Your said about using Argument arrays are right . The purpose i use
Argument arrays to do is also just as it should to be . What i want to do is
that I want to use uncertain number of Argument Arrays ,so i want to  create
Argument arrays dynamically. You said that they do not have a new operator
by design ,so i can't use "new" way. I maybe create an certain number of
Argument Arrays which is much more than i want ,and it may waste some
memories. Whether there has another way to realize my thought?

welcome to talk about it.



Kayler.

2009/8/29 Christian Schulte <[email protected]>

Hi,



Argument arrays are meant for what they are called: passing arguments as is
explained in detail in Section 4.2.2 in Modeling with Gecode. Using them for
other purposes is a bad idea and hence they do not have a new operator by
design!



What you should do is use a different data structure and create and argument
array just when you need it for posting a propagator or branching.



Christian



From: [email protected] [mailto:[email protected]] On Behalf
Of Kayler Yao
Sent: Saturday, August 29, 2009 5:20 AM
To: [email protected]
Subject: Re: [gecode-users] help --- how to create an object dynamically in
Gecode?



hi,

  And i find that "Gecode::Support::DynamicArray< T, A > Class Template"
maybe can realize it. But i did it  unsuccessfully.

Who can give me right answer.



Kayler

2009/8/29 Kayler Yao <[email protected]>

hi,

    I want to create an object of IntArgs in my program dynamically. For
instance " IntArgs *pt = new IntArgs(4); -----create an object of IntArgs
with four elements" or

"IntArgs *pt = new IntArgs [10];------create an array with 10 object of
IntArgs." They all be compiled with errors. And i haven't seen the examples
of create object dynamically in Gecode. And I want to know whether the
Gecode support to create object of Gecode class ? And how ?

Look forward to your reply!



Kayler





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

Reply via email to