- Solution

This lesson explains the solution for the exercise in the previous lesson.

We'll cover the following...

Solution #

Press + to interact
struct OnlyInt{
OnlyInt(int){}
template<typename T>
OnlyInt(T) = delete;
};
int main(){
OnlyInt(5);
OnlyInt(5L);
OnlyInt(5LL);
OnlyInt(5UL);
OnlyInt(5.5);
OnlyInt('5');
OnlyInt(true);
}

Explanation

...