Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #120911
| From | wij <wyniijj5@gmail.com> |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | How to make the Process ctor work for different R type? |
| Date | 2024-11-19 10:38 +0800 |
| Organization | A noiseless patient Spider |
| Message-ID | <c7d5064e0ec2f7720f1b6cef381666cfbf249cdb.camel@gmail.com> (permalink) |
struct Process {
template<typename R>
explicit Process(R (*pfunc)(), bool ret_int=false) {
int pid= fork();
if(pid==-1) {
throw "Error";
}
if(pid==0) {
if(ret_int) {
_exit( pfunc() ); // error: invalid use of void expression
} else {
pfunc(); // ret value ignored
_exit(0);
}
}
};
}
The issue is _exit(int) require int type.
void f();
Process proc(f); // error: R is void
So, how to make the Process ctor work for different R type?
Back to comp.lang.c++ | Previous | Next — Next in thread | Find similar | Unroll thread
How to make the Process ctor work for different R type? wij <wyniijj5@gmail.com> - 2024-11-19 10:38 +0800
Re: How to make the Process ctor work for different R type? red floyd <no.spam.here@its.invalid> - 2024-11-18 20:34 -0800
Re: How to make the Process ctor work for different R type? James Kuyper <jameskuyper@alumni.caltech.edu> - 2024-11-19 01:04 -0500
Re: How to make the Process ctor work for different R type? Muttley@DastartdlyHQ.org - 2024-11-19 08:27 +0000
Re: How to make the Process ctor work for different R type? Paavo Helde <eesnimi@osa.pri.ee> - 2024-11-19 10:45 +0200
Re: How to make the Process ctor work for different R type? Muttley@DastartdlyHQ.org - 2024-11-19 09:15 +0000
Re: How to make the Process ctor work for different R type? red floyd <no.spam.here@its.invalid> - 2024-11-20 07:23 -0800
Re: How to make the Process ctor work for different R type? scott@slp53.sl.home (Scott Lurndal) - 2024-11-20 15:47 +0000
Re: How to make the Process ctor work for different R type? Sam <sam@email-scan.com> - 2024-11-19 07:07 -0500
Re: How to make the Process ctor work for different R type? wij <wyniijj5@gmail.com> - 2024-11-19 21:16 +0800
Re: How to make the Process ctor work for different R type? Paavo Helde <eesnimi@osa.pri.ee> - 2024-11-19 16:15 +0200
Re: How to make the Process ctor work for different R type? Sam <sam@email-scan.com> - 2024-11-20 07:51 -0500
Re: How to make the Process ctor work for different R type? Bonita Montero <Bonita.Montero@gmail.com> - 2024-11-19 16:13 +0100
Re: How to make the Process ctor work for different R type? wij <wyniijj5@gmail.com> - 2024-11-20 00:30 +0800
Re: How to make the Process ctor work for different R type? Bonita Montero <Bonita.Montero@gmail.com> - 2024-11-19 17:42 +0100
Re: How to make the Process ctor work for different R type? Bonita Montero <Bonita.Montero@gmail.com> - 2024-11-21 15:27 +0100
Re: How to make the Process ctor work for different R type? Muttley@DastartdlyHQ.org - 2024-11-21 16:11 +0000
Re: How to make the Process ctor work for different R type? Bonita Montero <Bonita.Montero@gmail.com> - 2024-11-21 17:59 +0100
Re: How to make the Process ctor work for different R type? Muttley@DastartdlyHQ.org - 2024-11-22 09:54 +0000
Re: How to make the Process ctor work for different R type? wij <wyniijj5@gmail.com> - 2024-11-22 00:32 +0800
csiph-web