foo.cc: In function ‘int main()’:
foo.cc:15:23: error: no match for ‘operator-’ (operand types are ‘std::unordered_set<int>’ and ‘int’)
15 | if (s.count(s - x))
| ~ ^ ~
| | |
| | int
| std::unordered_set<int>
In file included from /nix/gcc-14.2.1.20250322/include/c++/14.2.1.20250322/string:48,
from /nix/gcc-14.2.1.20250322/include/c++/14.2.1.20250322/bits/locale_classes.h:40,
from /nix/gcc-14.2.1.20250322/include/c++/14.2.1.20250322/bits/ios_base.h:41,
from /nix/gcc-14.2.1.20250322/include/c++/14.2.1.20250322/ios:44,
from /nix/gcc-14.2.1.20250322/include/c++/14.2.1.20250322/ostream:40,
from iostream:41:
/nix/gcc-14.2.1.20250322/include/c++/14.2.1.20250322/bits/stl_iterator.h:618:5: note: candidate: ‘template<class _IteratorL, class _IteratorR> decltype ((__y.base() - __x.base())) std::operator-(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)’
618 | operator-(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/nix/gcc-14.2.1.20250322/include/c++/14.2.1.20250322/bits/stl_iterator.h:618:5: note: template argument deduction/substitution failed:
foo.cc:15:25: note: ‘std::unordered_set<int>’ is not derived from ‘const std::reverse_iterator<_Iterator>’
15 | if (s.count(s - x))
| ^
/nix/gcc-14.2.1.20250322/include/c++/14.2.1.20250322/bits/stl_iterator.h:1790:5: note: candidate: ‘template<class _IteratorL, class _IteratorR> decltype ((__x.base() - __y.base())) std::operator-(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)’
1790 | operator-(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/nix/gcc-14.2.1.20250322/include/c++/14.2.1.20250322/bits/stl_iterator.h:1790:5: note: template argument deduction/substitution failed:
foo.cc:15:25: note: ‘std::unordered_set<int>’ is not derived from ‘const std::move_iterator<_IteratorL>’
15 | if (s.count(s - x))
| ^