Hi,
Is it possible to use auto pointer to point to an existing variable?
I tried the following an get segfault:
I know that I can use new to allocate memory for "a" then assign the value of "c" to a, but that doesn't mean that 'a' point to c:Code:int c = 0; std::auto_ptr<int> a (&c);
Code:std::auto_ptr<int> a ( new int(c));