Can we use a constructor as predicate? So far what I manage to be able to do is this:
std::vector<const char*> v1 = {
"Hello", "from", "GCC", __VERSION__, "!"
};
std::vector<std::string> v2(v1.size());
std::transform(v1.begin(), v1.end(), v2.begin(),
[] (const char* s) { return std::string(s); });
But I want some way to do std::tranform( ..., std::string)
. I've tried std::string::string
, std::string::basic_string
and std::string::basic_string<char>
.