0
の配列を使用して、私は次のようなデータ構造との契約を持っている:はソリディティ - 充填および配列
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
}));
}
は、私がここでエラーが出ます:
Copying of type struct Roadshow.Answer memory[] memory to storage not yet supported.