Add const for Vertex id and getter

This commit is contained in:
Stefan Müller 2024-12-25 21:27:27 +01:00
parent d314b2fc70
commit c777bad38a
2 changed files with 3 additions and 3 deletions

View File

@ -23,10 +23,10 @@ class Vertex
{
public:
Vertex(const std::string id);
std::string getId() const;
const std::string getId() const;
const std::vector<std::weak_ptr<Vertex>>& getNeighbors() const;
void addNeighbor(const std::shared_ptr<Vertex>& neighbor);
private:
std::string id_;
const std::string id_;
std::vector<std::weak_ptr<Vertex>> neighbors_;
};

View File

@ -22,7 +22,7 @@ Vertex::Vertex(const std::string id)
{
}
std::string Vertex::getId() const
const std::string Vertex::getId() const
{
return id_;
}