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

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

Open
nolankramer opened this issue May 13, 2024 · 1 comment
Open

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

nolankramer opened this issue May 13, 2024 · 1 comment
Labels
core something about core enhancement New feature or request good first issue Good for newcomers Priority:Medium Priority Label for medium priority issue

Comments

@nolankramer
Copy link
Collaborator

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.

@ZigRazor
Copy link
Owner

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

@ZigRazor ZigRazor added enhancement New feature or request good first issue Good for newcomers Priority:Medium Priority Label for medium priority issue core something about core labels May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core something about core enhancement New feature or request good first issue Good for newcomers Priority:Medium Priority Label for medium priority issue
Projects
None yet
Development

No branches or pull requests

2 participants