摘要:
- **Why can I access private variables in the copy constructor?**The access modifiers work on **class level**, and not on object level.That is, two ob... 阅读全文
摘要:
本篇文章摘抄于——http://stackoverflow.com/questions/470683/memory-allocation-deallocation-bottleneck,主要讲了C/C++堆内存分配和释放导致性能问题的原因,并给出了基本的解决方案。C/C++堆内存分配和释放,即通过malloc/free或new/delete操作内存,主要会引起两个问题:一是内存碎片;二是堆内存操作需多线程同步,加锁(OS级别)。============================================================================Q:How mu 阅读全文
摘要:
转自:http://stackoverflow.com/questions/395123/raii-and-smart-pointers-in-cA simple (and perhaps overused) example of RAII is a File class. Without RAII, the code might look something like this:File file("/path/to/file");// Do stuff with filefile.close();In other words, we must make sure tha 阅读全文