Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed, CXXGraph::Node::getData() should not be const #438 #462

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/CXXGraph/Node/Node_decl.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class Node {
const CXXGraph::id_t &getId() const;
const std::string &getUserId() const;
const T &getData() const;
T& getData();
void setData(T &&new_data);
// operator
bool operator==(const Node<T> &b) const;
Expand Down
7 changes: 6 additions & 1 deletion include/CXXGraph/Node/Node_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ const T &Node<T>::getData() const {
return data;
}

template <typename T>
T& Node<T>::getData() {
return data;
}

template <typename T>
void Node<T>::setData(T &&new_data) {
this->data = std::move(new_data);
Expand Down Expand Up @@ -92,4 +97,4 @@ std::ostream &operator<<(std::ostream &os, const Node<T> &node) {

} // namespace CXXGraph

#endif // __CXXGRAPH_NODE_IMPL_H__
#endif // __CXXGRAPH_NODE_IMPL_H__
Loading