Jag writes:
virtex<T>* add_a_virtex(const virtex<T>& v1) {
//set<virtex<T> > _vertices ;
pair<set<virtex<T> >::iterator,bool> itt = _vertices.insert(v1) ;
/* code removed below */
}
on g++ I get this error.
sgraph.h: In member function `virtex<T>* sgraph<T>::add_a_virtex(const
virtex<T>&)':
sgraph.h:95: error: type/value mismatch at argument 1 in template
parameter list for `template<class _T1, class _T2> struct std::pair'
sgraph.h:95: error: expected a type, got `
std::set<virtex<T>,std::less<virtex<T> >,std::allocator<virtex<T> >
::iterator'
sgraph.h:95: error: invalid type in declaration before '=' token
Can some kind soul help me to fix the issue using g++.
There's probably a problem somewhere in either the definition of your
virtex template class, or your _vertices object. However, because you
neglected to post your class definitions, no further help is possible.
The only thing that I can tell you is that the following complete
example which, as far as I can tell using my best guess, is
structurally equivalent with your use case, compiles just fine with
g++ 4.4.4:
#include <set>
template<typename T> class virtex {
public:
bool operator<(const virtex<T> &) const;
};
class T {
};
std::set< virtex<T> > _vertices;
void add_a_virtex(const virtex<T> &v1)
{
std::pair<std::set<virtex<T> >::iterator, bool>
itt=_vertices.insert(v1);
}
crucial element of the OP's code that leads to the error message. As
// ...
the OP's problem to your example (which might have been a clue :). The
interpretation from both Jonathan and Alf is the correct one.