C++20 Concepts Are the Fix
Concepts let you write: template<std::integral T> T clamp(T val, T lo, T hi); which is readable, gives clear error messages when the constraint is violated, and compiles faster. If you are on C++20, just use concepts and forget SFINAE existed.