/ Vijos /

记录详情

Compile Error

/in/foo.cc: In function 'int main()':
/in/foo.cc:34:18: error: no matching function for call to 'std::vector<int>::emplace(int&)'
   id[x].emplace(i), id[y].emplace(i);
                  ^
In file included from /usr/include/c++/6/vector:64:0,
                 from /in/foo.cc:4:
/usr/include/c++/6/bits/stl_vector.h:971:9: note: candidate: template<class ... _Args> std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::emplace(std::vector<_Tp, _Alloc>::const_iterator, _Args&& ...) [with _Args = {_Args ...}; _Tp = int; _Alloc = std::allocator<int>]
         emplace(const_iterator __position, _Args&&... __args);
         ^~~~~~~
/usr/include/c++/6/bits/stl_vector.h:971:9: note:   template argument deduction/substitution failed:
/in/foo.cc:34:18: note:   cannot convert 'i' (type 'int') to type 'std::vector<int>::const_iterator {aka __gnu_cxx::__normal_iterator<const int*, std::vector<int> >}'
   id[x].emplace(i), id[y].emplace(i);
                  ^
/in/foo.cc:34:36: error: no matching function for call to 'std::vector<int>::emplace(int&)'
   id[x].emplace(i), id[y].emplace(i);
                                    ^
In file included from /usr/include/c++/6/vector:64:0,
                 from /in/foo.cc:4:
/usr/include/c++/6/bits/stl_vector.h:971:9: note: candidate: template<class ... _Args> std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::emplace(std::vector<_Tp, _Alloc>::const_iterator, _Args&& ...) [with _Args = {_Args ...}; _Tp = int; _Alloc = std::allocator<int>]
         emplace(const_iterator __position, _Args&&... __args);
         ^~~~~~~
/usr/include/c++/6/bits/stl_vector.h:971:9: note:   template argument deduction/substitution failed:
/in/foo.cc:34:36: note:   cannot convert 'i' (type 'int') to type 'std::vector<int>::const_iterator {aka __gnu_cxx::__normal_iterator<const int*, std::vector<int> >}'
   id[x].emplace(i), id[y].emplace(i);
                                    ^

信息

递交者
类型
自测
题目
P1000 A+B Problem
语言
C++
递交时间
2021-02-22 15:22:36
评测时间
2021-02-22 15:22:36
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes