Programming Challenge 2
Description
Create and test a generic array class, similar to std::array
.
Provide operations for constructing and accessing the data. Write a generic
function sort that operates on any type inside your array. Finally, write
specializations of the class and function for the character data type. The
specialized class would store the characters in a string instead of a literal
array. Don't write your own sort, instead invoke std::sort
inside
of your function (simply to save time).
Details
- Name the file and program
generic_array.h
and
test.cpp
, respectively.
- In your top file comment, please reflect on this exercise. Briefly state
what you learned about template programming.