How to use vector class
Posted: Wed Apr 06, 2011 10:35 am
[quote][I want to create an array of flags using the vector function. I created a vector called flag.
objref flag // this statement is written inside the a template but outside proc init()
public flag // this statement is written inside the a template but outside proc init()
flag = new Vector(22,0) // (22 flags and initializing them to zero), this is written inside proc init()
Now if I set the flag to 1 by using flag.set(0,1)
and then later check if this condition is true by
if( flag.get(0) == 1){
statement to be executed if condition is true.}
I am getting a syntax error in flag.get(0) ==1 statement. How do I rectify the syntax. Also in the documentation I read that flag.x supercedes flag.get(i) and flag.set(i,j) function as it can do both the functions. Also I wanted to know what is x. do I have to declare and initialize it .
Also declaring a vector public is allowed inside a template.
What does vsrcdest mean in x= vsrcdest.fill(value)/quote]
objref flag // this statement is written inside the a template but outside proc init()
public flag // this statement is written inside the a template but outside proc init()
flag = new Vector(22,0) // (22 flags and initializing them to zero), this is written inside proc init()
Now if I set the flag to 1 by using flag.set(0,1)
and then later check if this condition is true by
if( flag.get(0) == 1){
statement to be executed if condition is true.}
I am getting a syntax error in flag.get(0) ==1 statement. How do I rectify the syntax. Also in the documentation I read that flag.x supercedes flag.get(i) and flag.set(i,j) function as it can do both the functions. Also I wanted to know what is x. do I have to declare and initialize it .
Also declaring a vector public is allowed inside a template.
What does vsrcdest mean in x= vsrcdest.fill(value)/quote]