Reputation: 337
I have the following vector:
std::vector<std::string_view> const keys{"A1", "A2", "A3", "B1", "C1"};
I want to create a vector of std::string
out of it without iterating over it.
Upvotes: 3
Views: 4098
Reputation: 52611
std::vector<std::string> v(keys.begin(), keys.end());
should do it. Of course, there's iteration hidden inside that constructor.
Upvotes: 5