answer.code:4:13: error: ‘std::vector<int> write’ redeclared as different kind of entity
4 | vector<int> write, read;
| ^~~~~
In file included from /usr/include/c++/11/bits/atomic_wait.h:44,
from /usr/include/c++/11/bits/atomic_base.h:41,
from /usr/include/c++/11/bits/shared_ptr_atomic.h:33,
from /usr/include/c++/11/memory:78,
from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:82,
from answer.code:1:
/usr/include/unistd.h:366:16: note: previous declaration ‘ssize_t write(int, const void*, size_t)’
366 | extern ssize_t write (int __fd, const void *__buf, size_t __n) __wur;
| ^~~~~
answer.code:4:20: error: ‘std::vector<int> read’ redeclared as different kind of entity
4 | vector<int> write, read;
| ^~~~
In file included from /usr/include/unistd.h:1166,
from /usr/include/c++/11/bits/atomic_wait.h:44,
from /usr/include/c++/11/bits/atomic_base.h:41,
from /usr/include/c++/11/bits/shared_ptr_atomic.h:33,
from /usr/include/c++/11/memory:78,
from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:82,
from answer.code:1:
/usr/include/x86_64-linux-gnu/bits/unistd.h:34:1: note: previous declaration ‘ssize_t read(int, void*, size_t)’
34 | read (int __fd, void *__buf, size_t __nbytes)
| ^~~~
answer.code: In function ‘int main()’:
answer.code:41:14: error: request for member ‘push_back’ in ‘read’, which is of non-class type ‘ssize_t(int, void*, size_t)’ {aka ‘long int(int, void*, long unsigned int)’}
41 | read.push_back(cur);
| ^~~~~~~~~
answer.code:47:15: error: request for member ‘push_back’ in ‘write’, which is of non-class type ‘ssize_t(int, const void*, size_t)’ {aka ‘long int(int, const void*, long unsigned int)’}
47 | write.push_back(put);
| ^~~~~~~~~
answer.code:52:29: error: request for member ‘size’ in ‘read’, which is of non-class type ‘ssize_t(int, void*, size_t)’ {aka ‘long int(int, void*, long unsigned int)’}
52 | for(int i = 3; i < read.size(); i++){
| ^~~~
answer.code:54:17: error: request for member ‘size’ in ‘read’, which is of non-class type ‘ssize_t(int, void*, size_t)’ {aka ‘long int(int, void*, long unsigned int)’}
54 | if(read.size() >= 2 * n){
| ^~~~
answer.code:56:44: error: request for member ‘size’ in ‘read’, which is of non-class type ‘ssize_t(int, void*, size_t)’ {aka ‘long int(int, void*, long unsigned int)’}
56 | for(int j = 0, k = i; k < read.size(); k++, j++){
| ^~~~
answer.code:57:26: warning: pointer to a function used in arithmetic [-Wpointer-arith]
57 | if(read[k] != write[j]){
| ^
answer.code:57:38: warning: pointer to a function used in arithmetic [-Wpointer-arith]
57 | if(read[k] != write[j]){
| ^
answer.code:57:28: error: comparison between distinct pointer types ‘ssize_t (*)(int, void*, size_t)’ {aka ‘long int (*)(int, void*, long unsigned int)’} and ‘ssize_t (*)(int, const void*, size_t)’ {aka ‘long int (*)(int, const void*, long unsigned int)’} lacks a cast [-fpermissive]
57 | if(read[k] != write[j]){
| ~~~~~~~~^~~~~~~~~~~
answer.code:73:14: error: request for member ‘push_back’ in ‘read’, which is of non-class type ‘ssize_t(int, void*, size_t)’ {aka ‘long int(int, void*, long unsigned int)’}
73 | read.push_back(cur);
| ^~~~~~~~~
answer.code:79:15: error: request for member ‘push_back’ in ‘write’, which is of non-class type ‘ssize_t(int, const void*, size_t)’ {aka ‘long int(int, const void*, long unsigned int)’}
79 | write.push_back(put);
| ^~~~~~~~~
answer.code:82:20: error: request for member ‘size’ in ‘read’, which is of non-class type ‘ssize_t(int, void*, size_t)’ {aka ‘long int(int, void*, long unsigned int)’}
82 | while(read.size() >= 2 * p)
| ^~~~
answer.code:86:44: error: request for member ‘size’ in ‘read’, which is of non-class type ‘ssize_t(int, void*, size_t)’ {aka ‘long int(int, void*, long unsigned int)’}
86 | for(int j = 0, k = p; k < read.size(); k++, j++){
| ^~~~
answer.code:87:26: warning: pointer to a function used in arithmetic [-Wpointer-arith]
87 | if(read[k] != write[j]){
| ^
answer.code:87:38: warning: pointer to a function used in arithmetic [-Wpointer-arith]
87 | if(read[k] != write[j]){
| ^
answer.code:87:28: error: comparison between distinct pointer types ‘ssize_t ...