Skip to content

Commit 87c83e8

Browse files
authored
Fixed, CXXGraph::Node::getData() should not be const #438 (#462)
* Fixed, CXXGraph::Node::getData() should not be const #438 * Fixed the build failure * Fix some lint issues * Update Node_decl.h Fixed lint issue * Update Node_impl.hpp fixed lint issue
1 parent 58d507f commit 87c83e8

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

include/CXXGraph/Node/Node_decl.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ class Node {
4848
const CXXGraph::id_t &getId() const;
4949
const std::string &getUserId() const;
5050
const T &getData() const;
51+
T& getData();
5152
void setData(T &&new_data);
5253
// operator
5354
bool operator==(const Node<T> &b) const;

include/CXXGraph/Node/Node_impl.hpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@ const T &Node<T>::getData() const {
6565
return data;
6666
}
6767

68+
template <typename T>
69+
T &Node<T>::getData() {
70+
return data;
71+
}
72+
6873
template <typename T>
6974
void Node<T>::setData(T &&new_data) {
7075
this->data = std::move(new_data);
@@ -92,4 +97,4 @@ std::ostream &operator<<(std::ostream &os, const Node<T> &node) {
9297

9398
} // namespace CXXGraph
9499

95-
#endif // __CXXGRAPH_NODE_IMPL_H__
100+
#endif // __CXXGRAPH_NODE_IMPL_H__

0 commit comments

Comments
 (0)