Following my previous question
Protected member is unknown for derived class
I cannot understand which part of that line is wrong, Any idea?
There is a compile error here:
template <typename K, typename T>
bool graph<K, T>::is_edge(const K& k1, const K& k2)
{
if (this->nod.find(k1) == this->nod.end() || this->nod.find(k2) == this->nod.end())
throw std::string("is_edge: Node does not exist");
if (k1 < k2) // Below line makes error: expected primary-expression!!!!
return std::find(this->edg.begin(), this->edg.end(), edge(k1, k2)) != this->edg.end();
return std::find(this->edg.begin(), this->edg.end(), edge(k2, k1)) != this->edg.end();
}
Or, what’s wrong with this statement:
std::find(this->edg.begin(), this->edg.end(), edge(k1, k2)) != this->edg.end();
The complete code is here, where you can test and compile it.
You can resolve through the derived class to the base class like so (at least LLVM can =):