I'm trying to copy a QList in a std::vector this is my code:
std::copy(_param_31.listJobs->list_USCOREjobs.begin(),
_param_31.listJobs->list_USCOREjobs.end(),
listJobs.toVector().toStdVector().begin());
_param_31.listJobs->list_USCOREjobs // is a vector
listJobs // is a QList
and error is:
no match for 'operator=' in '* __result = * __first'
Thanks you very much.
toStdVector()
creates a new vector that has the same elements as the Qt collection. Assigning to this vector won't have any effect on the original collection. toVector()
also just creates a temporary.
I haven't used Qt but it looks like Qt containers can be used pretty much the same as standard containers. So, assuming you're trying to replace the contents of listJobs
with the contents of _param_31.listJobs->list_USCOREjobs
I think you can do it like this:
listJobs.clear();
std::copy(_param_31.listJobs->list_USCOREjobs.begin(),
_param_31.listJobs->list_USCOREjobs.end(),
std::back_inserter(listJobs));