Why do C++ libraries and frameworks never use smart pointers?

后端 未结 8 717
时光取名叫无心
时光取名叫无心 2020-12-22 15:09

I read in a few articles that raw pointers should almost never be used. Instead they should always be wrapped inside smart pointers, whether it\'s scoped or shared pointers.

8条回答
  •  春和景丽
    2020-12-22 15:54

    It also depends on what domain you work in. I write game engines for a living, we avoid boost like the plague, in games the overhead of boost isn't acceptable. In our core engine we ended up writing our own version of stl (Much like the ea stl).

    If i was to write a forms application, i might consider using smart pointers; but once memory management is second nature not having granular control over memory becomes quiet annoying.

提交回复
热议问题