Skip to content
Snippets Groups Projects
Commit 8d5909f6 authored by Adrian Seeligmüller's avatar Adrian Seeligmüller
Browse files

added [[nodiscard]]
parent 72d5d786
No related branches found
No related tags found
No related merge requests found
......@@ -7,7 +7,7 @@
struct Node
{
std::shared_ptr<Person> person;
std::shared_ptr<Person> person{};
std::shared_ptr<Node> left{};
std::shared_ptr<Node> right{};
};
......@@ -18,16 +18,16 @@ public:
void printTree();
void insert(std::shared_ptr<Person> &person, std::shared_ptr<Node> &node);
std::shared_ptr<Node> &getRoot();
[[nodiscard]] std::shared_ptr<Node> &getRoot();
void setRoot(const std::shared_ptr<Node> &newRoot);
int height(std::shared_ptr<Node> &node);
[[nodiscard]] int height(std::shared_ptr<Node> &node);
bool isBalanced();
[[nodiscard]] bool isBalanced();
private:
std::shared_ptr<Node> root = nullptr;
void printTree(const std::string &prefix, std::shared_ptr<Node> &node, bool isLeft);
bool isBalanced(std::shared_ptr<Node> &node);
[[nodiscard]] bool isBalanced(std::shared_ptr<Node> &node);
};
#endif //TREE_H
......@@ -37,7 +37,7 @@ public:
void loadFile(const std::string &path);
//getter setter
std::list<std::shared_ptr<Person>> &getRegistered();
[[nodiscard]] std::list<std::shared_ptr<Person>> &getRegistered();
void setRegistered(const std::list<std::shared_ptr<Person>> &newRegistered);
[[nodiscard]] Tree &getTreeData();
......
......@@ -24,7 +24,7 @@ public:
[[nodiscard]] bool operator<(std::shared_ptr<Person> &other) const;
friend bool operator<(std::shared_ptr<Person> &lhs, std::shared_ptr<Person> &rhs);
int idToInt() const;
[[nodiscard]] int idToInt() const;
//getter setter
[[nodiscard]] std::string getName() const;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment