Ray's playground

 

2012年3月7日

Item 19: Understand the origin of temporary objects.(More Effective C++)

摘要: The bottom line is that temporary objects can be costly, so you want to eliminate them whenever you can. More important than this, however, is to train yourself to look for places where temporary objects may be created. Anytime you see a reference-to-const parameter, the possibility exists that ... 阅读全文

posted @ 2012-03-07 13:29 Ray Z 阅读(193) 评论(0) 推荐(0) 编辑

Item 18: Amortize the cost of expected computations.(More Effective C++)

摘要: There is a common theme running through this Item, and that's that greater speed can often be purchased at a cost of increased memory usage. Keeping track of running minima, maxima, and averages requires extra space, but it saves time. Caching results necessitates greater memory usage but reduce 阅读全文

posted @ 2012-03-07 12:59 Ray Z 阅读(194) 评论(0) 推荐(0) 编辑

导航