Let's say that I have a vector<string> input and I need to pass this to a function that takes a const char** argument. My thought had been to use a unique_ptr like this:
const auto output = make_unique<char*>(size(input));
But I can't seem to turn a const unique_ptr<const*> into a const char**. Is there a way to accomplish this, or perhaps a simpler alternative?
I would just build a vector of pointers to the
c_str()'s of the strings and then get a pointer to that.Or using a
unique_ptr