#include <iostream>
using namespace std;
template<typename Type, int FixedTemplatedValue>
void TemplatedFunc(Type value)
{
std::cout << "Fixed templated value: " << FixedTemplatedValue
<< "\tPassed in changable value: " << value << std::endl;
}
int main()
{
auto FuncSeventeen = &TemplatedFunc<std::string, 17>;
auto FuncTwoHundred = &TemplatedFunc<float, 200>;
//NOTE: These functions always print "17" as their fixed value,
//because it's now BUILT INTO the function.
//They also always take a std::string as their first parameter, because it's BUILT IN at compile time,
//but they let you decide at run time what the value of that string is.
FuncSeventeen("Meow");
FuncSeventeen("Purr");
//NOTE: These functions always print "200" as their fixed value,
//because it's now BUILT INTO the function.
//They also always take a float as their first parameter, because it's BUILT IN at compile time,
//but they let you decide at run time what the value of that float is.
FuncTwoHundred(0.257f);
FuncTwoHundred(1.5f);
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKdGVtcGxhdGU8dHlwZW5hbWUgVHlwZSwgaW50IEZpeGVkVGVtcGxhdGVkVmFsdWU+CnZvaWQgVGVtcGxhdGVkRnVuYyhUeXBlIHZhbHVlKQp7CglzdGQ6OmNvdXQgPDwgIkZpeGVkIHRlbXBsYXRlZCB2YWx1ZTogIiA8PCBGaXhlZFRlbXBsYXRlZFZhbHVlCgkgICAgICAgICAgPDwgIlx0UGFzc2VkIGluIGNoYW5nYWJsZSB2YWx1ZTogIiA8PCB2YWx1ZSA8PCBzdGQ6OmVuZGw7Cn0KCmludCBtYWluKCkKewoJYXV0byBGdW5jU2V2ZW50ZWVuID0gJlRlbXBsYXRlZEZ1bmM8c3RkOjpzdHJpbmcsIDE3PjsKCWF1dG8gRnVuY1R3b0h1bmRyZWQgPSAmVGVtcGxhdGVkRnVuYzxmbG9hdCwgMjAwPjsKCQoJLy9OT1RFOiBUaGVzZSBmdW5jdGlvbnMgYWx3YXlzIHByaW50ICIxNyIgYXMgdGhlaXIgZml4ZWQgdmFsdWUsIAoJLy9iZWNhdXNlIGl0J3Mgbm93IE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