Add const for Vertex id and getter
This commit is contained in:
parent
d314b2fc70
commit
c777bad38a
|
@ -23,10 +23,10 @@ class Vertex
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Vertex(const std::string id);
|
Vertex(const std::string id);
|
||||||
std::string getId() const;
|
const std::string getId() const;
|
||||||
const std::vector<std::weak_ptr<Vertex>>& getNeighbors() const;
|
const std::vector<std::weak_ptr<Vertex>>& getNeighbors() const;
|
||||||
void addNeighbor(const std::shared_ptr<Vertex>& neighbor);
|
void addNeighbor(const std::shared_ptr<Vertex>& neighbor);
|
||||||
private:
|
private:
|
||||||
std::string id_;
|
const std::string id_;
|
||||||
std::vector<std::weak_ptr<Vertex>> neighbors_;
|
std::vector<std::weak_ptr<Vertex>> neighbors_;
|
||||||
};
|
};
|
||||||
|
|
|
@ -22,7 +22,7 @@ Vertex::Vertex(const std::string id)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Vertex::getId() const
|
const std::string Vertex::getId() const
|
||||||
{
|
{
|
||||||
return id_;
|
return id_;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue