I don't quite understand why std::shared_ptr considered to be "heavy" and "expensive", but std::array "same performance as plain (c-style) arrays"? As in shared-ptr we have pointer and two counters: for shared and weak references. And in std::array we have pointer to a data and it's size(basically same as a pointer's counts in shared_ptr). Seems to be same overhead, though everywhere it's written that is has "performance and accessibility of a C-style array".
Aucun commentaire:
Enregistrer un commentaire