Alex Rivera | Logout

Smart pointers - cases where they cannot replace raw pointers

Asked 2010-04-07T14:17:13.443
11

HI,

I have this query about smart pointers.

I heard from one of my friends that smart pointers can almost always replace raw pointers. but when i asked him what are the other cases where smart pointers cannot replace the raw pointers,i did not get the answer from him.

could anybody please tell me when and where they cannot replace raw pointers?

Edit
Report

1 Answer

1

It would be quite hard to implement smart pointers if at some point you don't use plain pointers.

I suppose it would also be harder to implement certain data structures with smart pointers. E.g freeing the memory of a regular linked list is quite trivial, but it would take some thought to figure out the combination of owning and non-owning smart pointers to get the same result.

answered 2010-04-07T15:12:49.903

Your Answer