Код: Выделить всё
void Read(std::uint8_t* buffer, int position, int size)
{
std::shared_ptr data = ReadImpl(position, size);
}
class Buffer
{
std::uint8_t* data;
std::int32_t size{};
}
Код: Выделить всё
ReadImpl()Мне нужно назначить данные из Buffer параметру buffer ( время жизни которого управляется вызывающей функцией Read()).
Я пробовал:
Код: Выделить всё
void Read(std::uint8_t* buffer, int position, int size)
{
std::shared_ptr data = ReadImpl(position, size);
memcpy(buffer, data->data, data->size)
}
Подробнее здесь: https://stackoverflow.com/questions/788 ... aw-pointer
Мобильная версия