#include #include "templates_top.h" class LocalTypeB { public: bool the_val = false; }; #ifdef B_WITH_HELPER template struct helper< T, std::enable_if_t< std::is_same::value > > : std::true_type {}; template<> int do_foo(LocalTypeB bb); #endif #ifdef B_IN_IMPL template<> int do_foo(LocalTypeB bb); #else template std::enable_if_t::value, int> do_foo(T bb) { // Some detailed business logic here // specific to LocalTypeB that ideally isn't in a header // Also - we need to invoke generic impl of the same template further up return do_foo(bb.the_val); } #endif