I have a vector vec of structures. Such a structure has elements int a, int b, int c
. I would like to assign to some int var
the element c, from the last structure in a vector. Please can you provide me with this simple solution? I'm going circle in line like this:
var = vec.end().c;
var=v[v.size() - 1];
Must check if vector is not empty. – Antisyphilitic*vec.rbegin()
– Partin