I am currently learning smart pointers and am trying to do the following:
#include <memory>
#include <string>
int main() {
std::unique_ptr<std::string[]> str_array(new std::string[5]);
for (int i = 0; i < 5; i++) {
std::getline(std::cin, str_array.get()[i]);
}
return 0;
}
This code simply scans 5 std::string objects into an array.
However, the debugger shows that the memory is not getting reserved for 5 objects:
What am I doing wrong?
