답안 #346647

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
346647 2021-01-10T14:34:37 Z youngyojun 두 개의 원 (balkan11_2circles) C++17
컴파일 오류
0 ms 0 KB
#include <vector>
#include <algorithm>
int main()
{
    int a;
    std::vector< std::vector <int> > v;
    std::vector< std::vector <int> >::const_iterator it = std::find( v.begin(), v.end(), a );
}

Compilation message

twocircles.cpp: In function 'int main()':
twocircles.cpp:7:54: warning: variable 'it' set but not used [-Wunused-but-set-variable]
    7 |     std::vector< std::vector <int> >::const_iterator it = std::find( v.begin(), v.end(), a );
      |                                                      ^~
In file included from /usr/include/c++/9/bits/stl_algobase.h:71,
                 from /usr/include/c++/9/vector:60,
                 from twocircles.cpp:1:
/usr/include/c++/9/bits/predefined_ops.h: In instantiation of 'bool __gnu_cxx::__ops::_Iter_equals_val<_Value>::operator()(_Iterator) [with _Iterator = __gnu_cxx::__normal_iterator<std::vector<int>*, std::vector<std::vector<int> > >; _Value = const int]':
/usr/include/c++/9/bits/stl_algo.h:120:14:   required from '_RandomAccessIterator std::__find_if(_RandomAccessIterator, _RandomAccessIterator, _Predicate, std::random_access_iterator_tag) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<std::vector<int>*, std::vector<std::vector<int> > >; _Predicate = __gnu_cxx::__ops::_Iter_equals_val<const int>]'
/usr/include/c++/9/bits/stl_algo.h:161:23:   required from '_Iterator std::__find_if(_Iterator, _Iterator, _Predicate) [with _Iterator = __gnu_cxx::__normal_iterator<std::vector<int>*, std::vector<std::vector<int> > >; _Predicate = __gnu_cxx::__ops::_Iter_equals_val<const int>]'
/usr/include/c++/9/bits/stl_algo.h:3938:28:   required from '_IIter std::find(_IIter, _IIter, const _Tp&) [with _IIter = __gnu_cxx::__normal_iterator<std::vector<int>*, std::vector<std::vector<int> > >; _Tp = int]'
twocircles.cpp:7:92:   required from here
/usr/include/c++/9/bits/predefined_ops.h:241:17: error: no match for 'operator==' (operand types are 'std::vector<int>' and 'const int')
  241 |  { return *__it == _M_value; }
      |           ~~~~~~^~~~~~~~~~~
In file included from /usr/include/c++/9/bits/stl_algobase.h:67,
                 from /usr/include/c++/9/vector:60,
                 from twocircles.cpp:1:
/usr/include/c++/9/bits/stl_iterator.h:886:5: note: candidate: 'template<class _IteratorL, class _IteratorR, class _Container> bool __gnu_cxx::operator==(const __gnu_cxx::__normal_iterator<_IteratorL, _Container>&, const __gnu_cxx::__normal_iterator<_IteratorR, _Container>&)'
  886 |     operator==(const __normal_iterator<_IteratorL, _Container>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/9/bits/stl_iterator.h:886:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/9/bits/stl_algobase.h:71,
                 from /usr/include/c++/9/vector:60,
                 from twocircles.cpp:1:
/usr/include/c++/9/bits/predefined_ops.h:241:17: note:   'std::vector<int>' is not derived from 'const __gnu_cxx::__normal_iterator<_IteratorL, _Container>'
  241 |  { return *__it == _M_value; }
      |           ~~~~~~^~~~~~~~~~~
In file included from /usr/include/c++/9/bits/stl_algobase.h:67,
                 from /usr/include/c++/9/vector:60,
                 from twocircles.cpp:1:
/usr/include/c++/9/bits/stl_iterator.h:893:5: note: candidate: 'template<class _Iterator, class _Container> bool __gnu_cxx::operator==(const __gnu_cxx::__normal_iterator<_Iterator, _Container>&, const __gnu_cxx::__normal_iterator<_Iterator, _Container>&)'
  893 |     operator==(const __normal_iterator<_Iterator, _Container>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/9/bits/stl_iterator.h:893:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/9/bits/stl_algobase.h:71,
                 from /usr/include/c++/9/vector:60,
                 from twocircles.cpp:1:
/usr/include/c++/9/bits/predefined_ops.h:241:17: note:   'std::vector<int>' is not derived from 'const __gnu_cxx::__normal_iterator<_Iterator, _Container>'
  241 |  { return *__it == _M_value; }
      |           ~~~~~~^~~~~~~~~~~
In file included from /usr/include/c++/9/bits/stl_algobase.h:64,
                 from /usr/include/c++/9/vector:60,
                 from twocircles.cpp:1:
/usr/include/c++/9/bits/stl_pair.h:448:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator==(const std::pair<_T1, _T2>&, const std::pair<_T1, _T2>&)'
  448 |     operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
      |     ^~~~~~~~
/usr/include/c++/9/bits/stl_pair.h:448:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/9/bits/stl_algobase.h:71,
                 from /usr/include/c++/9/vector:60,
                 from twocircles.cpp:1:
/usr/include/c++/9/bits/predefined_ops.h:241:17: note:   'std::vector<int>' is not derived from 'const std::pair<_T1, _T2>'
  241 |  { return *__it == _M_value; }
      |           ~~~~~~^~~~~~~~~~~
In file included from /usr/include/c++/9/bits/stl_algobase.h:67,
                 from /usr/include/c++/9/vector:60,
                 from twocircles.cpp:1:
/usr/include/c++/9/bits/stl_iterator.h:325:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_Iterator>&)'
  325 |     operator==(const reverse_iterator<_Iterator>& __x,
      |     ^~~~~~~~
/usr/include/c++/9/bits/stl_iterator.h:325:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/9/bits/stl_algobase.h:71,
                 from /usr/include/c++/9/vector:60,
                 from twocircles.cpp:1:
/usr/include/c++/9/bits/predefined_ops.h:241:17: note:   'std::vector<int>' is not derived from 'const std::reverse_iterator<_Iterator>'
  241 |  { return *__it == _M_value; }
      |           ~~~~~~^~~~~~~~~~~
In file included from /usr/include/c++/9/bits/stl_algobase.h:67,
                 from /usr/include/c++/9/vector:60,
                 from twocircles.cpp:1:
/usr/include/c++/9/bits/stl_iterator.h:363:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_IteratorR>&)'
  363 |     operator==(const reverse_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/9/bits/stl_iterator.h:363:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/9/bits/stl_algobase.h:71,
                 from /usr/include/c++/9/vector:60,
                 from twocircles.cpp:1:
/usr/include/c++/9/bits/predefined_ops.h:241:17: note:   'std::vector<int>' is not derived from 'const std::reverse_iterator<_Iterator>'
  241 |  { return *__it == _M_value; }
      |           ~~~~~~^~~~~~~~~~~
In file included from /usr/include/c++/9/bits/stl_algobase.h:67,
                 from /usr/include/c++/9/vector:60,
                 from twocircles.cpp:1:
/usr/include/c++/9/bits/stl_iterator.h:1139:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const std::move_iterator<_IteratorL>&, const std::move_iterator<_IteratorR>&)'
 1139 |     operator==(const move_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/9/bits/stl_iterator.h:1139:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/9/bits/stl_algobase.h:71,
                 from /usr/include/c++/9/vector:60,
                 from twocircles.cpp:1:
/usr/include/c++/9/bits/predefined_ops.h:241:17: note:   'std::vector<int>' is not derived from 'const std::move_iterator<_IteratorL>'
  241 |  { return *__it == _M_value; }
      |           ~~~~~~^~~~~~~~~~~
In file included from /usr/include/c++/9/bits/stl_algobase.h:67,
                 from /usr/include/c++/9/vector:60,
                 from twocircles.cpp:1:
/usr/include/c++/9/bits/stl_iterator.h:1145:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const std::move_iterator<_IteratorL>&, const std::move_iterator<_IteratorL>&)'
 1145 |     operator==(const move_iterator<_Iterator>& __x,
      |     ^~~~~~~~
/usr/include/c++/9/bits/stl_iterator.h:1145:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/9/bits/stl_algobase.h:71,
                 from /usr/include/c++/9/vector:60,
                 from twocircles.cpp:1:
/usr/include/c++/9/bits/predefined_ops.h:241:17: note:   'std::vector<int>' is not derived from 'const std::move_iterator<_IteratorL>'
  241 |  { return *__it == _M_value; }
      |           ~~~~~~^~~~~~~~~~~
In file included from /usr/include/c++/9/vector:64,
                 from twocircles.cpp:1:
/usr/include/c++/9/bits/allocator.h:168:5: note: candidate: 'template<class _T1, class _T2> bool std::operator==(const std::allocator<_Tp1>&, const std::allocator<_T2>&)'
  168 |     operator==(const allocator<_T1>&, const allocator<_T2>&)
      |     ^~~~~~~~
/usr/include/c++/9/bits/allocator.h:168:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/9/bits/stl_algobase.h:71,
                 from /usr/include/c++/9/vector:60,
                 from twocircles.cpp:1:
/usr/include/c++/9/bits/predefined_ops.h:241:17: note:   'std::vector<int>' is not derived from 'const std::allocator<_Tp1>'
  241 |  { return *__it == _M_value; }
      |           ~~~~~~^~~~~~~~~~~
In file included from /usr/include/c++/9/vector:67,
                 from twocircles.cpp:1:
/usr/include/c++/9/bits/stl_vector.h:1888:5: note: candidate: 'template<class _Tp, class _Alloc> bool std::operator==(const std::vector<_Tp, _Alloc>&, const std::vector<_Tp, _Alloc>&)'
 1888 |     operator==(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y)
      |     ^~~~~~~~
/usr/include/c++/9/bits/stl_vector.h:1888:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/9/bits/stl_algobase.h:71,
                 from /usr/include/c++/9/vector:60,
                 from twocircles.cpp:1:
/usr/include/c++/9/bits/predefined_ops.h:241:17: note:   mismatched types 'const std::vector<_Tp, _Alloc>' and 'const int'
  241 |  { return *__it == _M_value; }
      |           ~~~~~~^~~~~~~~~~~
In file included from /usr/include/c++/9/bits/char_traits.h:40,
                 from /usr/include/c++/9/string:40,
                 from /usr/include/c++/9/stdexcept:39,
                 from /usr/include/c++/9/array:39,
                 from /usr/include/c++/9/tuple:39,
                 from /usr/include/c++/9/functional:54,
                 from /usr/include/c++/9/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/9/algorithm:71,
                 from twocircles.cpp:2:
/usr/include/c++/9/bits/postypes.h:222:5: note: candidate: 'template<class _StateT> bool std::operator==(const std::fpos<_StateT>&, const std::fpos<_StateT>&)'
  222 |     operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs)
      |     ^~~~~~~~
/usr/include/c++/9/bits/postypes.h:222:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/9/bits/stl_algobase.h:71,
                 from /usr/include/c++/9/vector:60,
                 from twocircles.cpp:1:
/usr/include/c++/9/bits/predefined_ops.h:241:17: note:   'std::vector<int>' is not derived from 'const std::fpos<_StateT>'
  241 |  { return *__it == _M_value; }
      |           ~~~~~~^~~~~~~~~~~
In file included from /usr/include/c++/9/bits/basic_string.h:48,
                 from /usr/include/c++/9/string:55,
                 from /usr/include/c++/9/stdexcept:39,
                 from /usr/include/c++/9/array:39,
                 from /usr/include/c++/9/tuple:39,
                 from /usr/include/c++/9/functional:54,
                 from /usr/include/c++/9/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/9/algorithm:71,
                 from twocircles.cpp:2:
/usr/include/c++/9/string_view:473:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(std::basic_string_view<_CharT, _Traits>, std::basic_string_view<_CharT, _Traits>)'
  473 |     operator==(basic_string_view<_CharT, _Traits> __x,
      |     ^~~~~~~~
/usr/include/c++/9/string_view:473:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/9/bits/stl_algobase.h:71,
                 from /usr/include/c++/9/vector:60,
                 from twocircles.cpp:1:
/usr/include/c++/9/bits/predefined_ops.h:241:17: note:   'std::vector<int>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
  241 |  { return *__it == _M_value; }
      |           ~~~~~~^~~~~~~~~~~
In file included from /usr/include/c++/9/bits/basic_string.h:48,
                 from /usr/include/c++/9/string:55,
                 from /usr/include/c++/9/stdexcept:39,
                 from /usr/include/c++/9/array:39,
                 from /usr/include/c++/9/tuple:39,
                 from /usr/include/c++/9/functional:54,
                 from /usr/include/c++/9/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/9/algorithm:71,
                 from twocircles.cpp:2:
/usr/include/c++/9/string_view:479:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(std::basic_string_view<_CharT, _Traits>, std::__detail::__idt<std::basic_string_view<_CharT, _Traits> >)'
  479 |     operator==(basic_string_view<_CharT, _Traits> __x,
      |     ^~~~~~~~
/usr/include/c++/9/string_view:479:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/9/bits/stl_algobase.h:71,
                 from /usr/include/c++/9/vector:60,
                 from twocircles.cpp:1:
/usr/include/c++/9/bits/predefined_ops.h:241:17: note:   'std::vector<int>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
  241 |  { return *__it == _M_value; }
      |           ~~~~~~^~~~~~~~~~~
In file included from /usr/include/c++/9/bits/basic_string.h:48,
                 from /usr/include/c++/9/string:55,
                 from /usr/include/c++/9/stdexcept:39,
                 from /usr/include/c++/9/array:39,
                 from /usr/include/c++/9/tuple:39,
                 from /usr/include/c++/9/functional:54,
                 from /usr/include/c++/9/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/9/algorithm:71,
                 from twocircles.cpp:2:
/usr/include/c++/9/string_view:485:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(std::__detail::__idt<std::basic_string_view<_CharT, _Traits> >, std::basic_string_view<_CharT, _Traits>)'
  485 |     operator==(__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
      |     ^~~~~~~~
/usr/include/c++/9/string_view:485:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/9/bits/stl_algobase.h:71,
                 from /usr/include/c++/9/vector:60,
                 from twocircles.cpp:1:
/usr/include/c++/9/bits/predefined_ops.h:241:17: note:   mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int'
  241 |  { return *__it == _M_value; }
      |           ~~~~~~^~~~~~~~~~~
In file included from /usr/include/c++/9/string:55,
                 from /usr/include/c++/9/stdexcept:39,
                 from /usr/include/c++/9/array:39,
                 from /usr/include/c++/9/tuple:39,
                 from /usr/include/c++/9/functional:54,
                 from /usr/include/c++/9/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/9/algorithm:71,
                 from twocircles.cpp:2:
/usr/include/c++/9/bits/basic_string.h:6141:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&, const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
 6141 |     operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/9/bits/basic_string.h:6141:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/9/bits/stl_algobase.h:71,
                 from /usr/include/c++/9/vector:60,
                 from twocircles.cpp:1:
/usr/include/c++/9/bits/predefined_ops.h:241:17: note:   'std::vector<int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
  241 |  { return *__it == _M_value; }
      |           ~~~~~~^~~~~~~~~~~
In file included from /usr/include/c++/9/string:55,
                 from /usr/include/c++/9/stdexcept:39,
                 from /usr/include/c++/9/array:39,
                 from /usr/include/c++/9/tuple:39,
                 from /usr/include/c++/9/functional:54,
                 from /usr/include/c++/9/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/9/algorithm:71,
                 from twocircles.cpp:2:
/usr/include/c++/9/bits/basic_string.h:6149:5: note: candidate: 'template<class _CharT> typename __gnu_cxx::__enable_if<std::__is_char<_Tp>::__value, bool>::__type std::operator==(const std::__cxx11::basic_string<_CharT>&, const std::__cxx11::basic_string<_CharT>&)'
 6149 |     operator==(const basic_string<_CharT>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/9/bits/basic_string.h:6149:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/9/bits/stl_algobase.h:71,
                 from /usr/include/c++/9/vector:60,
                 from twocircles.cpp:1:
/usr/include/c++/9/bits/predefined_ops.h:241:17: note:   'std::vector<int>' is not derived from 'const std::__cxx11::basic_string<_CharT>'
  241 |  { return *__it == _M_value; }
      |           ~~~~~~^~~~~~~~~~~
In file included from /usr/include/c++/9/string:55,
                 from /usr/include/c++/9/stdexcept:39,
                 from /usr/include/c++/9/array:39,
                 from /usr/include/c++/9/tuple:39,
                 from /usr/include/c++/9/functional:54,
                 from /usr/include/c++/9/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/9/algorithm:71,
                 from twocircles.cpp:2:
/usr/include/c++/9/bits/basic_string.h:6163:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const _CharT*, const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
 6163 |     operator==(const _CharT* __lhs,
      |     ^~~~~~~~
/usr/include/c++/9/bits/basic_string.h:6163:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/9/bits/stl_algobase.h:71,
                 from /usr/include/c++/9/vector:60,
                 from twocircles.cpp:1:
/usr/include/c++/9/bits/predefined_ops.h:241:17: note:   mismatched types 'const _CharT*' and 'std::vector<int>'
  241 |  { return *__it == _M_value; }
      |           ~~~~~~^~~~~~~~~~~
In file included from /usr/include/c++/9/string:55,
                 from /usr/include/c++/9/stdexcept:39,
                 from /usr/include/c++/9/array:39,
                 from /usr/include/c++/9/tuple:39,
                 from /usr/include/c++/