Skip to content

Instantly share code, notes, and snippets.

@jitpaul

jitpaul/Intro2 Secret

Created May 4, 2018
Embed
What would you like to do?
Templates
#include <iostream>
using namespace std;
template <int min, int max>
class ExampleClass {
};
int main() {
/*Incorrect usage of non-type parameters. They should be known at compile time.*/
int min1, max1;
cin >> min1; cin >> max1;
ExampleClass<min1, max1> ec1;
/*Correct Usage non-type parameters.*/
ExampleClass<0, 10> ec2;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment