我与以下数据结构签订了合同:
struct Answer
{
bytes32 name; // short name (up to 32 bytes)
uint voteCount; // number of accumulated votes
}
struct Question
{
bytes32 name; // short name (up to 32 bytes);
Answer[] answers;
}
Question[] public questions;
如何填充数组?
以下行不起作用:
function addQuestion(bytes32 _name, bytes32[] _answers) onlyOwner { // perhabs it should be possible that others as the owner can add
Answer[] memory answersLocal = new Answer[](_answers.length);
//Question memory question = Question(_name);
for (uint i = 0; i < _answers.length; i++) {
answersLocal[i] = Answer({
name: _answers[i],
voteCount: 0
});
}
questions.push(Question({
name: _name,
answers: answersLocal
}));
}
我在这里得到错误:
尚不支持将 struct Roadshow.Answer memory[] memory 类型复制到存储。