так как i - закрытый член базового класса, в производном классе его нет
ответа на свой вопрос я не нашел
Unless redefined in the derived class, members of a base class are also considered to be members of the derived class. The base class members are said to be inherited by the derived class.
$ cat > hello.S <<'EOF'
.data
.Lhello:
.ascii "Hello, world\n"
.text
.global _start
_start:
movl $1, %ebx
leal .Lhello, %ecx
movl $13, %edx
movl $4, %eax
int $0x80
movl $1, %eax
xorl %ebx, %ebx
int $0x80
EOF
$ gcc -m32 hello.S -nostdlib -o hello
$ ./hello
Hello, world
$
.text
.global _start
_start:
.incbin "code"
.text
.global _start
_start:
.byte 0xbb, 0x01, 0x00, 0x00, 0x00, 0x8d, 0x0d, 0xb8,
.byte 0x80, 0x04, 0x08, 0xba, 0x0d, 0x00, 0x00, 0x00,
.byte 0xb8, 0x04, 0x00, 0x00, 0x00, 0xcd, 0x80, 0xb8,
.byte 0x01, 0x00, 0x00, 0x00, 0x31, 0xdb, 0xcd, 0x80,
.byte 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x2c, 0x20, 0x77,
.byte 0x6f, 0x72, 0x6c, 0x64, 0x0a
Насколько я понял идею std::move, вызов в return move(t) должен осуществить перемещение данных класса t в t1 без вызова деструктора.
В реальной программе T содержит объект fstream, а в деструкторе осуществляется закрытие потока.
#include <unistd.h>
int main()
{
int fd[2][2];
pipe(fd[0]);
pipe(fd[1]);
pid_t pid_fork = fork();
if (!pid_fork) {
// Дочерний процесс
close(fd[0][1]);
close(fd[1][0]);
dup2(fd[0][0], STDIN_FILENO);
dup2(fd[1][1], STDOUT_FILENO);
execl("/bin/tr", "/bin/tr", "l", "r", NULL);
} else {
// Родительский процесс
close(fd[0][0]);
close(fd[1][1]);
char buf[1000];
ssize_t sz;
write(fd[0][1], "hello, world\n", sizeof("hello, world\n") - 1);
close(fd[0][1]);
sz = read(fd[1][0], buf, sizeof(buf));
if (sz > 0) {
write(STDOUT_FILENO, buf, sz);
}
}
}