QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#391808#13. RouterZhaoZiLongCompile Error//C++113.9kb2024-04-16 20:03:422024-04-16 20:03:42

Details

answer.code: In function ‘void matchRequest(Trie&, const Request&)’:
answer.code:70:68: error: no match for ‘operator[]’ (operand types are ‘const std::unordered_map<std::__cxx11::basic_string<char>, std::vector<std::__cxx11::basic_string<char> > >’ and ‘size_t’ {aka ‘long unsigned int’})
   70 |             pathParams[result.second[i].first] = request.parameters[i];
      |                                                                    ^
In file included from /usr/include/c++/13/unordered_map:41,
                 from answer.code:2:
/usr/include/c++/13/bits/unordered_map.h:990:7: note: candidate: ‘std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::mapped_type& std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](key_type&&) [with _Key = std::__cxx11::basic_string<char>; _Tp = std::vector<std::__cxx11::basic_string<char> >; _Hash = std::hash<std::__cxx11::basic_string<char> >; _Pred = std::equal_to<std::__cxx11::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::__cxx11::basic_string<char>, std::vector<std::__cxx11::basic_string<char> > > >; mapped_type = std::vector<std::__cxx11::basic_string<char> >; key_type = std::__cxx11::basic_string<char>]’
  990 |       operator[](key_type&& __k)
      |       ^~~~~~~~
/usr/include/c++/13/bits/unordered_map.h:990:29: note:   no known conversion for argument 1 from ‘size_t’ {aka ‘long unsigned int’} to ‘std::unordered_map<std::__cxx11::basic_string<char>, std::vector<std::__cxx11::basic_string<char> > >::key_type&&’ {aka ‘std::__cxx11::basic_string<char>&&’}
  990 |       operator[](key_type&& __k)
      |                  ~~~~~~~~~~~^~~
/usr/include/c++/13/bits/unordered_map.h:986:7: note: candidate: ‘std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::mapped_type& std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](const key_type&) [with _Key = std::__cxx11::basic_string<char>; _Tp = std::vector<std::__cxx11::basic_string<char> >; _Hash = std::hash<std::__cxx11::basic_string<char> >; _Pred = std::equal_to<std::__cxx11::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::__cxx11::basic_string<char>, std::vector<std::__cxx11::basic_string<char> > > >; mapped_type = std::vector<std::__cxx11::basic_string<char> >; key_type = std::__cxx11::basic_string<char>]’
  986 |       operator[](const key_type& __k)
      |       ^~~~~~~~
/usr/include/c++/13/bits/unordered_map.h:986:34: note:   no known conversion for argument 1 from ‘size_t’ {aka ‘long unsigned int’} to ‘const std::unordered_map<std::__cxx11::basic_string<char>, std::vector<std::__cxx11::basic_string<char> > >::key_type&’ {aka ‘const std::__cxx11::basic_string<char>&’}
  986 |       operator[](const key_type& __k)
      |                  ~~~~~~~~~~~~~~~~^~~