|
Blue Forest http://www.lslnet.com at 10:18 on June 6, 2006
How to transform into str variable of auto_ptr<string>
This is a C + + question. And there is a function as follow :
Auto_ptr<string>; testOne () (
Return auto_ptr<string>; result (new string ( "tonney"));
}
But I not specified 't know how to transform the result into variable of string.
Please help!
Thank you! |
How to transform into str variable of auto_ptr<string>
Auto_ptr<string>; result will return (new string ( "tonney")); Read :
[code]
Auto_ptr<string>; result (new string ( "tonney"));
Return result;
[/code] |
How to transform into str variable of auto_ptr<string>
-->
Can be read as follows :
[code]auto_ptr<string>; TestOne () (
Return * (auto_ptr<string>; (new string ( "tonney")));
}[/code] |
How to transform into str variable of auto_ptr<string>
Thank you THEBEST! |
How to transform into str variable of auto_ptr<string>
-->
Laws wrong. Auto_ptr<string>; asked to return is a function object (target), but not the string at the target object.
If they want to return to the provisional directly targeted, it should be done :
[code]
Auto_ptr<string>; testOne () (
Return auto_ptr<string>; (new string ( "tonney"));
}
[/code] |
How to transform into str variable of auto_ptr<string>
Oh, sorry.
Return string. Forget changed, because the landlord is to transform the result into variable of string. |
How to transform into str variable of auto_ptr<string>
In fact, okay, I know the usage of it now.
Thank you for your advice!
Thank you whyglinux and THEBEST!! |
| |