2017-02-28 77 views
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.

回答

0

,如果你想通过WEB3什么桥这样的访问合同。

该桥仍然不支持阵列数组,但坚固的支持!

我想如果错误是不变的,你会看到不同类型的错误。

希望这会有所帮助。