Does it make sense to use std :: shared_ptr <std :: vector> instead of boost :: shared_array?

Now I am rewriting part of my code to use the C ++ 11 standard. In some places I found the following code:

boost::shared_array<uint8_t> array; 

Does this replace:

 std::shared_ptr<std::vector<uint8_t>> array; 

I am trying to replace all boost functions that were already introduced in C ++ 11 in my code.

I need to clarify a bit. Actually I need a raw array (but with refcount, so it can be automatically deleted), not needed for all these vector functions. Therefore boost :: shared_array solves the problem I want at no additional cost. But I'm trying to make my code make the most of the new standard (although many libraries from boost are not yet covered by the new standard).

Thanks.

+6
source share
1 answer

Given the current state of C ++ 11 support in compilers and the laziness of the mainthing assembly, I would leave it as it is. Boost has the nice ability to work almost everywhere, including old compilers, and the change you want to make is unlikely to improve the code.

This code is also not quite the same.

+4
source

Source: https://habr.com/ru/post/944869/


All Articles