Answers for "Non-type template arguments"

C++
0

Non-type template arguments

// template arguments
#include <iostream>
using namespace std;

template <class T, int N>
T fixed_multiply (T val)
{
  return val * N;
}

int main() {
  std::cout << fixed_multiply<int,2>(10) << '\n';
  std::cout << fixed_multiply<int,3>(10) << '\n';
}
Posted by: Guest on May-29-2021

Code answers related to "Non-type template arguments"

Browse Popular Code Answers by Language