I wonder if it is possible to have template class where the member functions can only be called with the exact matching template type? Example:
template<typename T>
struct testClass {
void testMethod(T testParam) {};
};
int main() {
testClass<int> testObject;
int testInt;
testObject(testInt); //ok
testObject.testMethod(1.1f); //compile error, parameter is not int
}
Basically an adaption for templates from this: How do I avoid implicit conversions on non-constructing functions?, which I am not sure how to achieve.
Thanks