こんにちはすべて私はメンバー関数に次のものを持っています
int tt = 6;
vector<set<int>>& temp = m_egressCandidatesByDestAndOtMode[tt];
set<int>& egressCandidateStops = temp.at(dest);
および次のメンバー変数の宣言
map<int, vector<set<int>>> m_egressCandidatesByDestAndOtMode;
ただし、コンパイル時にエラーが発生します(Intelコンパイラ11.0)
1>C:\projects\svn\bdk\Source\ZenithAssignment\src\Iteration\PtBranchAndBoundIterationOriginRunner.cpp(85): error: no operator "[]" matches these operands
1> operand types are: const std::map<int, std::vector<std::set<int, std::less<int>, std::allocator<int>>, std::allocator<std::set<int, std::less<int>, std::allocator<int>>>>, std::less<int>, std::allocator<std::pair<const int, std::vector<std::set<int, std::less<int>, std::allocator<int>>, std::allocator<std::set<int, std::less<int>, std::allocator<int>>>>>>> [ const int ]
1> vector<set<int>>& temp = m_egressCandidatesByDestAndOtMode[tt];
1> ^
私はそれが愚かなことでなければならないことを知っていますが、私が間違ったことを見ることができません。
UPDATEこれをconstメンバー関数から呼び出しているので、メンバー変数の型はconstであるため、次のようなもので修正する必要があると思いました。
int dest = 0, tt = 6;
const set<int>& egressCandidateStops = m_egressCandidatesByDestAndOtMode[tt].at(dest);
しかし、サイコロはありません...それでも同じエラーです。