C++ Smart Pointer performance

前端 未结 6 1721
北荒
北荒 2021-02-07 05:24

How much do using smart pointers, particularly boost::shared_ptr cost more compared to bare pointers in terms of time and memory? Is using bare pointers better for performance i

6条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-07 05:46

    When I last tested, with VC6, the compiler wasn't able to optimize the code with a smart pointer as well as it could with a raw pointer. Things might have changed since then.

提交回复
热议问题