I tend to rarely use smart pointers. When I first was introduced to them, I overused shared_ptr, and I would often end up with some interesting crashes in destructors on program exit. Then I started thinking more about why I actually needed them for my situation, and it turns out I didn't. I often have manager classes that are the sole place for creation and destruction of whatever resource they're managing. When I need a pointer to a resource, I ask the manager for it.
Not that there aren't any reasons to use smart pointers, but I tend to structure code in a way where I don't need them. Sometimes this can't be done, and sometimes it'd just be too much work to refactor the code. I know of a multi-million line program that is littered with shared pointers, and occasionally those developers will run into a problem with them.
njpaulMember Since 30 Aug 2004
Offline Last Active Jun 20 2012 09:58 PM
- Group Members
- Active Posts 473
- Profile Views 1,008
- Submitted Links 0
- Member Title Member
- Age 28 years old
- Birthday July 6, 1985
njpaul hasn't added any contacts yet.