我有一个使用两个模板类 Trans 和 Travel 的主程序,它会生成一个编译错误use of deleted function 'MakeColor::MakeColor()
,并且:note: 'MakeColor::MakeColor()' is implicitly deleted because the default definition would be ill-formed
. 我怎样才能解决这个问题?
类旅行:
#include "Trans.hpp"
template<typename A, typename B, typename C>
class Travel {
public:
typedef Trans<A, B> CarType;
typedef Trans<C, int> BoatType;
typedef typename CarType::Newest NewestCar;
typedef typename BoatType::Newest NewestBoat;
};
类翻译:
template<typename A, typename B>
class Trans {
public:
class Newest;
};
主程序:
#include "Travel.hpp"
#include "Trans.hpp"
Travel<MakeColor, MakeMaterial, MakeSize>
struct MakeColor {
CarType::NewestCar model; // error
};
int main(){
...
}