So I am trying to change my game and I found a problem where I couldn't make the change:
I have the following code:
std::string fileContents = "";
const char* contentsPtr = fileContents.c_str();
I tried making it:
const std::unique_ptr<char> contentsPtr = fileContents.c_str();
It doesn't work since there is no constructor to make the conversion from char* to unique_ptr so how can I make this change?
c_str()is not up for grabs, it's owned byfileContents. You can't just shove it in aunique_ptrand let it own it. Why do you even think you need aunique_ptrin your case?contentsPtrat all? What does your code use it for?