2015-11-23 12 views

回答

2

你可以给第二个模板参数Box默认参数:

template <typename T, typename U=T> 
class Box { 
}; 

现在你可以写Box<T>Box<T,T>,但你仍然可以选择写Box<T,U>如果类型不同。