#include #ifdef B_WITH_HELPER template struct helper : std::false_type {}; template std::enable_if_t::value, int> do_foo(T bb) { static_assert(std::is_same::value && false, "Never do this"); } #endif #ifdef B_IN_IMPL template int do_foo(T bb) { static_assert(std::is_same::value && false, "Never do this"); } #endif template std::enable_if_t::value, int> do_foo(T bb) { // Some generic business logic for all fundamental types here // OK to live in a header, not much we can do here return 0; }