J
Jag
template <typename T>
vertex<T>* sgraph<T>::find_a_vertex(const vertex<T>& v) {
typename set<vertex<T> >::iterator itt = _vertices.find(v) ;
if (itt == _vertices.end()) {
return NULL ;
}
vertex<T>& sv = *itt ; //LINE X
vertex<T>* asv = &(sv) ;
return asv ;
}
LINE X
error: invalid initialization of reference of type 'vertex<int>&' from
expression of type 'const vertex<int>'
What exactly is the problem here? Thanks in advance
vertex<T>* sgraph<T>::find_a_vertex(const vertex<T>& v) {
typename set<vertex<T> >::iterator itt = _vertices.find(v) ;
if (itt == _vertices.end()) {
return NULL ;
}
vertex<T>& sv = *itt ; //LINE X
vertex<T>* asv = &(sv) ;
return asv ;
}
LINE X
error: invalid initialization of reference of type 'vertex<int>&' from
expression of type 'const vertex<int>'
What exactly is the problem here? Thanks in advance