我正在尝试创建自定义例程的动态数组:
struct RoutineValue{
std::string Name;
int Value;
long int Min;
long int Max;
bool substitute;
std::string subname;
};
class SubRoutine {
std::vector<RoutineValue> Values;
std::string RoutineType;
bool enabled;
};
struct Variables{
std::string Name;
int Value;
};
class CustomRoutine {
public:
std::string Name;
std::string Description;
std::vector<SubRoutine> SubRoutines;
std::vector<Variables> Subs;
};
我最初尝试像这样向向量添加一个项目,但编译器对此不满意。
std::vector<CustomRoutine> CRListLeft;
if(x){
CustomRoutine buf;
CRListLeft.push_back(buf);
}
IDE 给我这个错误:
In template: static assertion failed due to requirement 'is_constructible<SubRoutine, const SubRoutine &>::value': result type must be constructible from input type
我的编译器:
error: static assertion failed: result type must be constructible from input type
90 | static_assert(is_constructible<_ValueType, _Tp>::value,
确实问题是控制器和 TowerPoint。(不在最近的编辑中) 感谢您的浏览。 一旦我将它们更改为指针,我(无论如何需要)它就起作用了。 对于您的困惑,我们深表歉意,感谢您的帮助。