鉴于:
//hpp
template <typename T>
struct Demo {
template<typename U>
U convert(const T &t);
};
//cpp
template <typename T>
template <typename U>
U Demo<T>::convert(const T &t) {
return static_cast<U>(t);
}
Run Code Online (Sandbox Code Playgroud)
如何在cpp中显式实例化模板?(例如T是双,U是int)