STL implementation of problems

zhaozj2021-02-11  150

STL implementation of problems

When I started learning VC, I don't know what STL is, I only know what CString is convenient to come out, and enjoy the benefits of C from now on. Later, I saw the introduction of STL, I feel that it is a good thing, so I started the history of STL, and of course the STL used is also the implementation of VC6. Start reading a small program, the small project is still very good. The first discovered that the STL of the VC is when making an HTTP server, since the STL is the first choice, I really didn't think that it's Iostream is actually unsafe, my The console output is simply a mess. I am hurting to mutually exclusive, this is really enough. The strange thing is that VC's own iostream.h is a thread safe, but iostream.h is a little bit different from Host STL. If you use, you will modify the code, or what to use #ifDef thing. From that time, I thought about finding a good STL implementation version. I heard that the implementation of SGI is good, so I have made a try, okay, no problem, so I have been using. However, unfortunate things happened again, once again in the module of sending mail, the debugging of VC actually found that there was a memory leak, according to my experience, the code did not leak (I will be careful about the use of memory) And the information from the debugger indicates that some String objects have a memory leak. So, remove the SGI's INCLUDE directory from Options, recompile debugging, okay! It's really strange, is it really SGI's memory leak? I have no problem when I use it alone. Now I haven't understood what is the reason. In view of this, there is a STL that returns to VC. It is a pity that the good scene is not long, and the STL of the VC is found in the last test, and there is a shortcomings, let me fine. I don't know if you have encountered the situation where you want to insert a string in a String object (in fact, this should be often available)? For the demonstration, I simplifies the code as follows: #define n 2000 string body; // body.reserve (n * 26); for (int i = 0; i

转载请注明原文地址:https://www.9cbs.com/read-5528.html

New Post(0)