Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
一个初学者的问题:
如何在多模板类中的模板上放置条件:
我试过这个:
template <class T, class U> typename std::enable_if<...> class foo { };
还有这个:
template <class T, class U = std::enable_if<...>> class foo { };
但他们没有工作。任何帮助,将不胜感激 :)
声明一个默认为的附加模板参数void并将其专门化为enable_if:
void
enable_if
template <typename T, typename U, typename Enable = void> class foo {}; template <typename T, typename U> class foo<T, U, typename std::enable_if<...>::type> { };