I have a function myfunc()
which requires the parameters std::vector
, std::queue
, and a pointer to a MyClass
object.
My function prototype is:
void myFunc(vector<MyClass*>, std::queue<MyClass*>, MyClass*);
I do not know if this is the proper prototype declaration or not.
To call my function, i do the following:
myFunc(myVector, myQueue, MyClassObj);
Again, im not sure this is entirely correct.
Lastly, my function is the following:
void myFunc(vector<MyClass*> myVector, std::queue<MyClass*> myQueue, MyClass* myClassObj)
{
//do something
}
The function is supposed to search for a specific item in the vector. If it is not found, the myClassObj will be pushed to the queue. Otherwise, if the object is found, it will call another function to set the value of one of the parameters of the myClassObj.
Am i doing this correctly?
Thanks,
"The function is supposed to search for a specific item in the vector. If it is not found, the myClassObj will be pushed to the queue. Otherwise, if the object is found, it will call another function to set the value of one of the parameters of the myClassObj."
In that case,
vector
by const&
queue
by &
.....and MyClass
by &
or pointer if you prefer thatvoid myFunc(const vector<MyClass*>& myVector, std::queue<MyClass*>& myQueue, MyClass* myClassObj)
{
//do something
}