Question: 2 . Forgetful Vector - C + + In the folder ForgetfulVector is an implementation and header file. Write a class, named ForgetfulVector, that acts
Forgetful Vector C
In the folder ForgetfulVector is an implementation and header file. Write a class, named ForgetfulVector, that acts like a vector in that it supports the size, at and pushback methods. This class only needs to support the storage of ints templated classes will be taught later The one strange thing is that the ForgetfulVector forgets the first time it encounters a value, and doesnt present that value or give it an index.
Example use:
std::vector vec ; ForgetfulVector fv; fvpushback; fvpushback; fvpushback; fvpushback; Currently only "knows about" as it "forgets" the first occurrence of and assertfvsize; Should be fvpushback; now holds as this is the second time seeing a assertfvat; returns a as that is the value in index in this forgetful vector assertfvat;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
