S
Susan Baker
Hi,
I'm just reading about smart pointers..
I have some existing C code that I would like to provide wrapper classes
for. Specifically, I would like to provide wrappers for two stucts
defined as ff:
typedef struct {
float *data ;
int count ;
} series ;
typedef struct {
void *clientdata ;
FUNC_PTR1 cb1 ;
FUNC_PTR2 cb2 ;
struct param_ pdata ;
int size ;
} client
I am thinking of providing a wrapper for the first one as ff:
class Series {
std::auto_pointer<series> sPtr ;
....
}
Couple of quick questions:
1). Can I do this (I probably should have checked to see if it would
compile first)
2). From my understanding of auto_ptr, variable sPtr gets freed
automagically when class Series goes out of scope (I can't imagine how
this is possible)
3). Will the responses for the previous two statements hold true for a
more complicated structure like client above?
Thanks
I'm just reading about smart pointers..
I have some existing C code that I would like to provide wrapper classes
for. Specifically, I would like to provide wrappers for two stucts
defined as ff:
typedef struct {
float *data ;
int count ;
} series ;
typedef struct {
void *clientdata ;
FUNC_PTR1 cb1 ;
FUNC_PTR2 cb2 ;
struct param_ pdata ;
int size ;
} client
I am thinking of providing a wrapper for the first one as ff:
class Series {
std::auto_pointer<series> sPtr ;
....
}
Couple of quick questions:
1). Can I do this (I probably should have checked to see if it would
compile first)
2). From my understanding of auto_ptr, variable sPtr gets freed
automagically when class Series goes out of scope (I can't imagine how
this is possible)
3). Will the responses for the previous two statements hold true for a
more complicated structure like client above?
Thanks