The cost of passing by shared_ptr

前端 未结 5 1361
迷失自我
迷失自我 2020-12-07 09:35

I use std::tr1::shared_ptr extensively throughout my application. This includes passing objects in as function arguments. Consider the following:

class Datas         


        
5条回答
  •  佛祖请我去吃肉
    2020-12-07 10:20

    If you're not using make_shared, could you give that a go? By locating the reference count and the object in the same area of memory you may see a performance gain associated with cache coherency. Worth a try anyway.

提交回复
热议问题