memgraph/src/storage/model/edge_list.hpp

40 lines
737 B
C++
Raw Normal View History

2015-12-06 23:37:42 +08:00
#pragma once
#include <vector>
#include "mvcc/version_list.hpp"
class EdgeList
{
public:
auto begin() { return edges.begin(); }
auto begin() const { return edges.begin(); }
auto cbegin() const { return edges.begin(); }
auto end() { return edges.end(); }
auto end() const { return edges.end(); }
auto cend() const { return edges.end(); }
void add(EdgeRecord* edge)
{
edges.push_back(edge);
}
size_t degree() const
{
return edges.size();
}
void remove(EdgeRecord* edge)
{
edges.erase(std::remove(edges.begin(), edges.end(), edge), edges.end());
}
void clear()
{
edges.clear();
}
private:
std::vector<EdgeRecord*> edges;
};