CPP Module 07 introduced me to Templates in CPP.
The only requirements are:
- GNU make (v3.81)
- c++ (clang++) v.12.0.0
- compile with -std=c++98 flag.
Those versions are the ones used during development.
-
Download/Clone this repo
git clone https://github.com/qduong42/42_cpp_Module07
-
cd
into the exercise directories and runmake
for (int i = 00; i <= 02; i++) { cd 42_cpp_Module07/exi make }
After running make, you can run the program following the instructions printed in the terminal by the Makefile.
- Piscine style C++ Excercises to introduce us to C++ Beginner Concepts.
- Only code in a C++ way. C functions should be avoided as much as possible.
- NO CODING NORMS!
- No memory leaks
- Must have a Makefile to build the program
- Files to turn in partially given.
- Special functions operate generic types: Function template => Functionality adapted to more than 1 type or class.
- special kind param pass type as arg.
- template function_declaration;
- template function_declaration;
class/typename difference indistinct.
template myType max(myType a, myType b) { return (a>b?a:b); // if a > b, return a, otherwise b }
- Calling templates: max (param);
- type replaces all myType
Enjoy!