Using c++14, I have some function declarations that resemble the following.
template <class... Args>
struct potato {
template <class T, class = std::enable_if_t<!std::is_same<T, int>::value>>
const T& blee(size_t blou) const;
template <class T, class = std::enable_if_t<std::is_same<T, int>::value>>
const T& blee(size_t blou) const;
};
Is it possible to implement the functions separately? From what I can tell, there is no way the compiler can figure out what is implementing what. For example :
template <class... Args>
template <class T, class>
const T& potato<Args...>::blee(size_t blou) const {
// do something
}
template <class... Args>
template <class T, class>
const T& potato<Args...>::blee(size_t blou) const {
// do something
}
The enable_if
information is lost at that point. Am I missing a trick in my toolbag to make this work? Note that I'd rather not use return type enable_if
or argument enable_if
as they are ungodly.
edit : Updated to represent my use-case better.