islands.cpp: In function 'bool dfs(int, std::vector<int>&)':
islands.cpp:11:7: error: no match for 'operator[]' (operand types are 'std::vector<int>' and 'std::pair<int, int>')
11 | if(c[u] == 0) if(dfs(u, nds)) return 1;
| ^
In file included from /usr/include/c++/10/vector:67,
from islands.h:2,
from islands.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:1043:7: note: candidate: 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](std::vector<_Tp, _Alloc>::size_type) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::reference = int&; std::vector<_Tp, _Alloc>::size_type = long unsigned int]'
1043 | operator[](size_type __n) _GLIBCXX_NOEXCEPT
| ^~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1043:28: note: no known conversion for argument 1 from 'std::pair<int, int>' to 'std::vector<int>::size_type' {aka 'long unsigned int'}
1043 | operator[](size_type __n) _GLIBCXX_NOEXCEPT
| ~~~~~~~~~~^~~
/usr/include/c++/10/bits/stl_vector.h:1061:7: note: candidate: 'std::vector<_Tp, _Alloc>::const_reference std::vector<_Tp, _Alloc>::operator[](std::vector<_Tp, _Alloc>::size_type) const [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::const_reference = const int&; std::vector<_Tp, _Alloc>::size_type = long unsigned int]'
1061 | operator[](size_type __n) const _GLIBCXX_NOEXCEPT
| ^~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1061:28: note: no known conversion for argument 1 from 'std::pair<int, int>' to 'std::vector<int>::size_type' {aka 'long unsigned int'}
1061 | operator[](size_type __n) const _GLIBCXX_NOEXCEPT
| ~~~~~~~~~~^~~
islands.cpp:11:24: error: cannot convert 'std::pair<int, int>' to 'int'
11 | if(c[u] == 0) if(dfs(u, nds)) return 1;
| ^
| |
| std::pair<int, int>
islands.cpp:7:14: note: initializing argument 1 of 'bool dfs(int, std::vector<int>&)'
7 | bool dfs(int s, vector<int>& nds) {
| ~~~~^
islands.cpp:12:12: error: no match for 'operator[]' (operand types are 'std::vector<int>' and 'std::pair<int, int>')
12 | else if(c[u] == 1) {
| ^
In file included from /usr/include/c++/10/vector:67,
from islands.h:2,
from islands.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:1043:7: note: candidate: 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](std::vector<_Tp, _Alloc>::size_type) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::reference = int&; std::vector<_Tp, _Alloc>::size_type = long unsigned int]'
1043 | operator[](size_type __n) _GLIBCXX_NOEXCEPT
| ^~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1043:28: note: no known conversion for argument 1 from 'std::pair<int, int>' to 'std::vector<int>::size_type' {aka 'long unsigned int'}
1043 | operator[](size_type __n) _GLIBCXX_NOEXCEPT
| ~~~~~~~~~~^~~
/usr/include/c++/10/bits/stl_vector.h:1061:7: note: candidate: 'std::vector<_Tp, _Alloc>::const_reference std::vector<_Tp, _Alloc>::operator[](std::vector<_Tp, _Alloc>::size_type) const [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::const_reference = const int&; std::vector<_Tp, _Alloc>::size_type = long unsigned int]'
1061 | operator[](size_type __n) const _GLIBCXX_NOEXCEPT
| ^~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1061:28: note: no known conversion for argument 1 from 'std::pair<int, int>' to 'std::vector<int>::size_type' {aka 'long unsigned int'}
1061 | operator[](size_type __n) const _GLIBCXX_NOEXCEPT
| ~~~~~~~~~~^~~
islands.cpp:13:19: error: no matching function for call to 'std::vector<int>::push_back(std::pair<int, int>&)'
13 | nds.push_back(u);
| ^
In file included from /usr/include/c++/10/vector:67,
from islands.h:2,
from islands.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:1187:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::value_type = int]'
1187 | push_back(const value_type& __x)
| ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1187:35: note: no known conversion for argument 1 from 'std::pair<int, int>' to 'const value_type&' {aka 'const int&'}
1187 | push_back(const value_type& __x)
| ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/stl_vector.h:1203:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::value_type = int]'
1203 | push_back(value_type&& __x)
| ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1203:30: note: no known conversion for argument 1 from 'std::pair<int, int>' to 'std::vector<int>::value_type&&' {aka 'int&&'}
1203 | push_back(value_type&& __x)
| ~~~~~~~~~~~~~^~~
islands.cpp:11:5: warning: suggest explicit braces to avoid ambiguous 'else' [-Wdangling-else]
11 | if(c[u] == 0) if(dfs(u, nds)) return 1;
| ^