Is there a way, using C++11, to concatenate two std::vectors in one code line, with the first defined in a local variable, the second returned from a function:
#include <vector>
#include <iostream>
#include <iterator>
std::vector<int> getNewVector()
{
return {4,5,6};
}
int main(int argc, char** argv)
{
std::vector<int> dest;
std::vector<int> src{1,2,3};
dest = src + getNewVector(); //Error: no operator "+" matches these operands
return 0;
}
Aucun commentaire:
Enregistrer un commentaire