Hi,
is it similar case for sharet_ptr? I have a method
std::shared_ptr<char[]> MBRegister::ReadData(const int regAddr, const int regCount)
{
std::lock_guard<std::mutex> lg(lock);
char* res = nullptr;
if (regAddr >= 0 && regAddr + (regCount-1) <= registerCount)
{
res = new char[regCount * 2];
char* startRead = buffer + (regAddr * 2);
errno_t error = memcpy_s(res, regCount * 2, startRead, regCount * 2);
if (error != 0)
{
delete[] res;
res = nullptr;
}
}
return std::shared_ptr<char[]>(res);
}
I'm not sure how mock this method by using PRIVATE_WHEN_CALLED, or other construct.
Thank you
Daril