Beyond the C++ Standard Library: An Introduction to Boost [Electronic resources]

Bjorn Karlsson

نسخه متنی -صفحه : 124/ 25
نمايش فراداده

shared_array

Header: "boost/shared_array.hpp"

shared_array is a smart pointer that enables shared ownership of arrays. It is to shared_ptr what scoped_array is to scoped_ptr. shared_array differs from shared_ptr mainly in that it is used with arrays rather than a single object. When we discussed scoped_array, I mentioned that std::vector was often a better choice. But shared_array adds some value over vector, because it offers shared ownership of arrays. The shared_array interface is similar to that of shared_ptr, but with the addition of a subscript operator and without support for custom deleters.