CXXGraph icon indicating copy to clipboard operation
CXXGraph copied to clipboard

CXXGraph::Node::getData() should not be const

Open nolankramer opened this issue 1 year ago • 2 comments

The current function signature of CXXGraph::Node::getData() is:

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

This prevents users from modifying their stored data without const_cast. We should remove the qualifiers from this function. If the user wants read-only data, they should make the entire graph const.

nolankramer avatar May 13 '24 19:05 nolankramer

Maybe is better to duplicate the function, one with const on return value and on object, and one non-const function

ZigRazor avatar May 13 '24 21:05 ZigRazor

Hi, Can I work on this issue?

yapa-ymtl avatar Aug 05 '24 17:08 yapa-ymtl