I have a raw pointer which points to an array of data. I would like to wrap this pointer into a container with STL container semantics (e.g. std::vector). Does the STL have any feature which allows this?
e.g.
class my_class
{
public:
std::some_container<char> get_data() { return std::some_container(my_data, my_data_size);}
private:
char* my_data;
size_t my_data_size;
};
EDIT:
I cannot use std::vector directly since the memory is allocated by an external api.
STL doesn’t, boost does: