/ Vijos /

记录详情

Compile Error

/in/foo.cc: In function 'int main()':
/in/foo.cc:36:24: error: no matching function for call to 'std::vector<std::array<int, 3> >::push_back(<brace-enclosed initializer list>)'
   36 |         teams.push_back({a[0], a[1], a[2]});
      |         ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/12/vector:64,
                 from /in/foo.cc:9:
/usr/include/c++/12/bits/stl_vector.h:1276:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::array<int, 3>; _Alloc = std::allocator<std::array<int, 3> >; value_type = std::array<int, 3>]'
 1276 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/12/bits/stl_vector.h:1276:35: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const std::vector<std::array<int, 3> >::value_type&' {aka 'const std::array<int, 3>&'}
 1276 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/12/bits/stl_vector.h:1293:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = std::array<int, 3>; _Alloc = std::allocator<std::array<int, 3> >; value_type = std::array<int, 3>]'
 1293 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/12/bits/stl_vector.h:1293:30: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::vector<std::array<int, 3> >::value_type&&' {aka 'std::array<int, 3>&&'}
 1293 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
/in/foo.cc:52:35: error: no match for 'operator[]' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::array<int, 3> >, std::array<int, 3> >::value_type' {aka 'std::array<int, 3>'} and 'int')
   52 |                 int v = teams[tid][j];
      |                                   ^
/usr/include/c++/12/bits/stl_vector.h: In instantiation of 'std::_Vector_base<_Tp, _Alloc>::~_Vector_base() [with _Tp = std::array<int, 3>; _Alloc = std::allocator<std::array<int, 3> >]':
/usr/include/c++/12/bits/stl_vector.h:526:7:   required from here
/usr/include/c++/12/bits/stl_vector.h:367:49: error: invalid use of incomplete type 'struct std::array<int, 3>'
  367 |                       _M_impl._M_end_of_storage - _M_impl._M_start);
      |                       ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/12/bits/hashtable_policy.h:34,
                 from /usr/include/c++/12/bits/hashtable.h:35,
                 from /usr/include/c++/12/unordered_map:46,
                 from /in/foo.cc:11:
/usr/include/c++/12/tuple:1595:45: note: declaration of 'struct std::array<int, 3>'
 1595 |   template<typename _Tp, size_t _Nm> struct array;
      |                                             ^~~~~
In file included from /usr/include/c++/12/bits/stl_pair.h:60,
                 from /usr/include/c++/12/bits/stl_algobase.h:64,
                 from /usr/include/c++/12/algorithm:60,
                 from /in/foo.cc:8:
/usr/include/c++/12/type_traits: In instantiation of 'struct std::is_move_constructible<std::array<int, 3> >':
/usr/include/c++/12/bits/alloc_traits.h:792:12:   required from 'struct std::__is_move_insertable<std::allocator<std::array<int, 3> > >'
/usr/include/c++/12/bits/stl_vector.h:483:28:   required from 'static constexpr bool std::vector<_Tp, _Alloc>::_S_use_relocate() [with _Tp = std::array<int, 3>; _Alloc = std::allocator<std::array<int, 3> >]'
/usr/include/c++/12/bits/vector.tcc:77:44:   required from 'void std::vector<_Tp, _Alloc>::reserve(size_type) [with _Tp = std::array<int, 3>; _Alloc = std::allocator<std::array<int, 3> >; size_type = long unsigned int]'
/in/foo.cc:20:18:   required from here
/usr/include/c++/12/type_traits:1035:52: error: static assertion failed: template argument must be a complete class or an unbounded array
 1035 |       static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
      |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/12/type_traits:1035:52: note: 'std::__is_complete_or_unbounded<__type_identity<array<int, 3> > >((std::__type_identity<std::array<int, 3> >(), std::__type_identity<std::array<int, 3> >()))' evaluates to false
/usr/include/c++/12/type_traits: In substitution of 'template<class _Tp, class ... _Args> using __is_nothrow_constructible_impl = std::__bool_constant<__is_nothrow_constructible(_Tp)> [with _Tp = std::array<int, 3>; _Args = {std::array<int, 3>&&}]':
/usr/include/c++/12/type_traits:1095:12:   required from 'struct std::__is_nothrow_move_constructible_impl<std::array<int, 3>, true>'
/usr/include/c++/12/type_traits:1102:12:   required from 'struct std::is_nothrow_move_constructible<std::array<int, 3> >'
/usr/include/c++/12/type_traits:178:41:   required from 'struct std::__not_<std::is_nothrow_move_constructible<std::array<int, 3> > >'
/usr/include/c++/12/type_traits:167:12:   required from 'struct std::__and_<std::__not_<std::is_nothrow_move_constructible<std::array<int, 3> > >, std::is_copy_constructible<std::array<int, 3> > >'
/usr/include/c++/12/bits/move.h:109:12:   required from 'struct std::__move_if_noexcept_cond<std::array<int, 3> >'
/usr/include/c++/12/bits/stl_iterator.h:1806:26:   required by substitution of 'template<class _Tp, class _ReturnType> _ReturnType std::__make_move_if_noexcept_iterator(_Tp*) [with _Tp = std::array<int, 3>; _ReturnType = <missing>]'
/usr/include/c++/12/bits/vector.tcc:87:3:   required from 'void std::vector<_Tp, _Alloc>::reserve(size_type) [with _Tp = std::array<int, 3>; _Alloc = std::allocator<std::array<int, 3> >; size_type = long unsigned int]'
/in/foo.cc:20:18:   required from here
/usr/include/c++/12/type_traits:1042:25: error: invalid use of incomplete type 'struct std::array<int, 3>'
 1042 |       = __bool_constant<__is_nothrow_constructible(_Tp, _Args...)>;
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/12/tuple:1595:45: note: declaration of 'struct std::array<int, 3>'
 1595 |   template<typename _Tp, size_t _Nm> struct array;
      |                                             ^~~~~
/usr/include/c++/12/type_traits: In instantiation of 'struct std::is_nothrow_move_constructible<std::array<int, 3> >':
/usr/include/c++/12/type_traits:178:41:   required from 'struct std::__not_<std::is_nothrow_move_constructible<std::array<int, 3> > >'
/usr/include/c++/12/type_traits:167:12:   required from 'struct std::__and_<std::__not_<std::is_nothrow_move_constructible<std::array<int, 3> > >, std::is_copy_constructible<std::array<int, 3> > >'
/usr/include/c++/12/bits/move.h:109:12:   required from 'struct std::__move_if_noexcept_cond<std::array<int, 3> >'
/usr/include/c++/12/bits/stl_iterator.h:1806:26:   required by substitution of 'template<class _Tp, class _ReturnType> _ReturnType std::__make_move_if_noexcept_iterator(_Tp*) [with _Tp = std::array<int, 3>; _ReturnType = <missing>]'
/usr/include/c++/12/bits/vector.tcc:87:3:   required from 'void std::vector<_Tp, _Alloc>::reserve(size_type) [with _Tp = std::array<int, 3>; _Alloc = std::allocator<std::array<int, 3> >; size_type = long unsigned int]'
/in/foo.cc:20:18:   required from here
/usr/include/c++/12/type_traits:1102:12: error: no type named 'type' in 'struct std::__is_nothrow_move_constructible_impl<std::array<int, 3>, true>'
 1102 |     struct is_nothrow_move_constructible
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/12/type_traits:1105:52: error: static assertion failed: template argument must be a complete class or an unbounded array
 1105 |       static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
      |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/12/type_traits:1105:52: note: 'std::__is_complete_or_unbounded<__type_identity<array<int, 3> > >((std::__type_identity<std::array<int, 3> >(), std::__type_identity<std::array<int, 3> >()))' evaluates to false
/usr/include/c++/12/type_traits: In instantiation of 'struct std::__not_<std::is_nothrow_move_constructible<std::array<int, 3> > >':
/usr/include/c++/12

信息

递交者
类型
递交
题目
P1876 小岛的标号
语言
C++
递交时间
2026-10-28 23:50:56
评测时间
2026-10-28 23:50:56
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes