Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumC++SFINAE and enable_ifSingle-choice MCQ

Two overloads are constrained with std::enable_if as shown. What happens when you call `g(3.14)` (a double)?

#include <type_traits> template <class T, std::enable_if_t<std::is_integral_v<T>, int> = 0> void g(T) { /* integral */ } template <class T, std::enable_if_t<std::is_floating_point_v<T>, int> = 0> void g(T) { /* floating */ } // g(3.14);