ssercpp12 / Homework

Homework result for 12 sser cpp
1 stars 8 forks source link

About Vector #22

Open TchaikovDriver opened 11 years ago

TchaikovDriver commented 11 years ago

I want to achieve it by using a struct. But I am confused by the function "void insert(T* pos, T value)". Since T* pos cannot point to the struct, I don't know how to do it. Can I modify the parameter or I have to find another way to complement the class?

omegaga commented 11 years ago

Sorry for late reply, I missed it from my email.

You are not allowed to modify parameters of a member function because we will use them in our tests. Modifying them may lead to compile error or wrong answer.

Vector is a dynamic array. So T* obviously points to a specific position in the array. I don't know how a struct can be used in a vector. You can try to observe how vector in STL works, or just view the source.