I have a shared_ptr开发者_如何学运维 in the class like this
class App
{
public:
App(){};
~App(){};
private:
boost::shared_ptr<int> ab;
};
when I instanciate one App class in main, the stack gets corrupted?
int main(){
App myApp;
}
Does any one know why the error :" Run-Time Check Failure #2 - Stack around the variable 'myApp' was corrupted." appears, in Visual Studio?
shared_ptr needs no initialization it will be zero anyway or not? This is quite strange
The code you pasted is fine, shared_ptr has a sensible default ctor and will destruct fine
精彩评论