我的目标是创建一个TeamS类型为“TeamS”的向量。 TeamV应该有4个数据部分。例如:TeamV [0] = teamID,member1,member2,member3。 我找到了一种获取ID数组并分发到TeamV向量的方法。但我不能同时分配3名团队成员。我该怎么办?
import { createStore, combineReducers } from 'redux';
import loggedUserReducer from '../reducers/loggedUserReducer';
const reducers = combineReducers({
loggedUserState: loggedUserReducer
});
const store = createStore(reducers);
export default store;
答案 0 :(得分:0)
这就是Inistialize的样子。
void Initialize (vector <TeamS> & TeamV, const int id[],
const string m[][NUM_MEMBERS], int arraySize){
TeamV.resize(NUM_TEAMS);
for (int i = 0; i<NUM_TEAMS;++i) {
TeamV[i].ID = id[i];
for (int y = 0; y<NUM_MEMBERS;++y){
TeamV[i].teamMembers[y] = m[i][y];
}
}
}
但你有没有考虑过,你真的应该关注std::unordered_map<unsigned, std::vector<std::string>>
?