Код: Выделить всё
template
class NodeT {
public:
/* A node has a q vector, a parent ptr and a cost used externally for computation like finding the shortest path */
T q;
NodeT *parent;
double cost;
/**
* Constructor
*
* @param[in] q A q vector
* @param[in] parent Parent node pointer
* @param[in] cost Cost of the node that may be set during finding shortest path
*/
NodeT(const T &q, NodeT *parent = nullptr, double cost = 0.0) : q(q), parent(parent), cost(cost) {}
/**
* A hash function that uniquely identifies a node based on its q vector
*
* @param[in] hash A node
* @param[out] hash A string representing the node
*/
static inline std::size_t hash(const NodeT &node)
{
static THash f;
return f(node.q);
}
/* A wrapper of hash that is to be used by an unordered map on a Node */
struct Hash {
std::size_t operator()(const NodeT &node) const
{
return hash(node);
}
};
};
< /code>
И я пытаюсь определить шаблонную версию этого класса следующим образом: < /p>
template
class GraphT {
public:
typedef NodeT NodeInt;
typedef EdgeT EdgeInt;
typedef std::unordered_set NodesSet;
NodesSet _nodes;
}
Код: Выделить всё
: type/value mismatch at argument 2 in template parameter list for ‘template class std::unordered_set’
std::unordered_set x;
note: expected a type, got ‘GraphT::NodeInt:: Hash’
Подробнее здесь: https://stackoverflow.com/questions/796 ... ated-class