I have a class with a map<K,V>
variable which gets its value in the c'tor like so:
class Foo {
map<K,V> m;
Foo (map<K,V>& newM) : m(newM) {}
map<K,V>::iterator bar () { ... }
}
the function bar
iterates through the map m
, and return some an iterator to some element. I'm calling the function like this:
std::map<K,V> map;
//fill map
Foo foo(map);
map<K,V>::iterator it = foo.bar();
my question is, at this moment, does it point to a member of map
? or was it copied to Foo.m
and therefor the iterator points to a different map?