Construct a templated dynamically-growing array [C++]
Budget: $10 – $30 USD
Design a templated dynamically-growing array in C++:
The interface should provide these procedures:
- push_back(): adds a single element to the array
- [ ]: random access operator, to retrieve elements at a position (i.e. arr[2])
- remove_if(arr,condition) interface: takes the array and a condition, then removing any array element that satisfies the condition. i.e. ( x<12 ). input: 12, 14, 5, 20, 7 || output: 12, 14, 20
- get_size(): retrieves current array size
- clear(): remove all the elements of the array
Deliverable: A single C++ file (file.cpp) that contains the implementation of the array and a main function that demonstrates the interface.
The interface should provide these procedures:
- push_back(): adds a single element to the array
- [ ]: random access operator, to retrieve elements at a position (i.e. arr[2])
- remove_if(arr,condition) interface: takes the array and a condition, then removing any array element that satisfies the condition. i.e. ( x<12 ). input: 12, 14, 5, 20, 7 || output: 12, 14, 20
- get_size(): retrieves current array size
- clear(): remove all the elements of the array
Deliverable: A single C++ file (file.cpp) that contains the implementation of the array and a main function that demonstrates the interface.