foo.cc: In function ‘int main()’:
foo.cc:11:24: error: no matching function for call to ‘std::__cxx11::basic_string<char>::erase(int&, std::string&)’
11 | s.erase(p,s1);
| ~~~~~~~^~~~~~
In file included from /nix/gcc-13.3.0/include/c++/13.3.0/string:54,
from /nix/gcc-13.3.0/include/c++/13.3.0/bitset:52,
from stdc++.h:52:
/nix/gcc-13.3.0/include/c++/13.3.0/bits/basic_string.h:2069:7: note: candidate: ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::erase(size_type, size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]’
2069 | erase(size_type __pos = 0, size_type __n = npos)
| ^~~~~
/nix/gcc-13.3.0/include/c++/13.3.0/bits/basic_string.h:2069:44: note: no known conversion for argument 2 from ‘std::string’ {aka ‘std::__cxx11::basic_string<char>’} to ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’}
2069 | erase(size_type __pos = 0, size_type __n = npos)
| ~~~~~~~~~~^~~~~~~~~~
/nix/gcc-13.3.0/include/c++/13.3.0/bits/basic_string.h:2089:7: note: candidate: ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::iterator std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::erase(__const_iterator) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; iterator = std::__cxx11::basic_string<char>::iterator; __const_iterator = std::__cxx11::basic_string<char>::const_iterator]’
2089 | erase(__const_iterator __position)
| ^~~~~
/nix/gcc-13.3.0/include/c++/13.3.0/bits/basic_string.h:2089:7: note: candidate expects 1 argument, 2 provided
/nix/gcc-13.3.0/include/c++/13.3.0/bits/basic_string.h:2109:7: note: candidate: ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::iterator std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::erase(__const_iterator, __const_iterator) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; iterator = std::__cxx11::basic_string<char>::iterator; __const_iterator = std::__cxx11::basic_string<char>::const_iterator]’
2109 | erase(__const_iterator __first, __const_iterator __last)
| ^~~~~
/nix/gcc-13.3.0/include/c++/13.3.0/bits/basic_string.h:2109:30: note: no known conversion for argument 1 from ‘int’ to ‘std::__cxx11::basic_string<char>::__const_iterator’ {aka ‘std::__cxx11::basic_string<char>::const_iterator’}
2109 | erase(__const_iterator __first, __const_iterator __last)
| ~~~~~~~~~~~~~~~~~^~~~~~~
foo.cc:13:19: error: request for member ‘find’ in ‘p’, which is of non-class type ‘int’
13 | p.find(s1);
| ^~~~