Of Memory Management, Heap Corruption, and C++

后端 未结 12 1885
半阙折子戏
半阙折子戏 2020-12-01 02:54

So, I need some help. I am working on a project in C++. However, I think I have somehow managed to corrupt my heap. This is based on the fact that I added an std::stri

12条回答
  •  误落风尘
    2020-12-01 03:56

    As far as I can tell your code is correct. Assuming exampleString is an std::string that has class scope like you describe, you ought to be able to initialize/assign it that way. Perhaps there is some other issue? Maybe a snippet of actual code would help put it in context.

    Question: Is exampleString a pointer to a string object created with new?

提交回复
热议问题