Skip to content

Tarik Billa

  • Web Development
    • html
    • vue.js
    • laravel
    • css
    • javascript
    • jquery
    • node.js
    • php
    • asp.net
  • Programming
    • python
    • java
    • c
    • c++
    • c#
  • git
  • android

scoped-ptr

shared_ptr vs scoped_ptr

August 20, 2023 by Tarik

shared_ptr is more heavyweight than scoped_ptr. It needs to allocate and free a reference count object as well as the managed object, and to handle thread-safe reference counting – on one platform I worked on, this was a significant overhead. My advice (in general) is to use the simplest object that meets your needs. If … Read more

Categories c++ Tags boost, c++, scoped-ptr, shared-ptr, smart-pointers Leave a comment

Difference between boost::scoped_ptr and std::unique_ptr

March 21, 2023 by Tarik

No, but that is the most important difference. The other major difference is that unique_ptr can have a destructor object with it, similarly to how shared_ptr can. Unlike shared_ptr, the destructor type is part of the unique_ptr‘s type (the way allocators are part of STL container types). A const unique_ptr can effectively do most of … Read more

Categories c++ Tags c++, scoped-ptr, unique-ptr Leave a comment

Tarik Billa

Software Engineer
tarikbilla@gmail.com
+8801884414000
  • Reuse a hash in YAMLApril 17, 2024
  • Dockerfile: how to redirect the output of a RUN command to a variable?April 16, 2024
  • How to cd to a directory with spaces in the directory name?April 16, 2024
  • Maximum MIME type length when storing the type in a databaseApril 16, 2024
  • What is the difference between Unit, Integration, Regression and Acceptance Testing?April 16, 2024
© 2026 Tarik Billa