Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: 099228f4d3
Fetching contributors…

Cannot retrieve contributors at this time

58 lines (47 sloc) 1.061 kB
#ifndef NODE_H
#define NODE_H
namespace libgraph
{
template<typename T>
class node
{
public:
node(const T& input, bool nullity = false) : value(input), id(0), null(false)
{
if(false == nullity)
{
id = counter++; // counting from 0 is handy in C++
}
else
{
null = true;
}
}
static void reset()
{
counter = 0;
}
bool operator==(const node<T>& n) const
{
return (value == n.value) && (id == n.id);
}
bool operator!=(const node<T>& n) const
{
return (value != n.value) || (id != n.id);
}
bool is_null() const
{
return null;
}
T value;
size_t id;
bool null;
private:
node& operator = (const node& other) {}
node(const node& other) {}
static size_t counter;
};
template<typename T>
size_t node<T>::counter = 0;
} // namespace libgraph
#endif // NODE_H
Jump to Line
Something went wrong with that request. Please try again.