Ask your own question, for FREE!
Computer Science 18 Online
OpenStudy (anonymous):

Hey, I'm having trouble understanding my C++ assignment. I need to create a function that takes as input a single const parameter of type vector. Does that mean the function is of type vector, or the const parameter?

OpenStudy (anonymous):

It means the functions take a parameter of type const vector<T> as below (change return type to whatever your function returns): void functionA(const vector<T> v) {} This means that the caller of the function can be assured that function won't modify the state of the vector because the function will only be able to call methods on the parameter which are marked const, which can't modify the member variables of the object. (unless they're marked mutable but most of the time this is true)

OpenStudy (anonymous):

Thanks! That was really helpful!

OpenStudy (anonymous):

hi

OpenStudy (anonymous):

hi

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!