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

Allow jmespath to be const qualified #530

Closed
nnathan opened this issue Jul 26, 2024 · 2 comments
Closed

Allow jmespath to be const qualified #530

nnathan opened this issue Jul 26, 2024 · 2 comments

Comments

@nnathan
Copy link

nnathan commented Jul 26, 2024

I would like to see the ability to allow const reference to a jmespath_expression, to ensure that it's read-only and allow the compiler to do any optimisations.

It appears that the jmespath_expression::evaluate() are not const methods and therefore preventing making a useful const reference.

I was a bit concerned that the jmespath_expression was mutating itself each evaluate, but after applying a const to the evaluate() methods, and then made the jmespath_expression a const reference, it didn't seem to have any issue.

@danielaparker
Copy link
Owner

You're right, evaluate() should be const, it never mutates the state of the jmespath_expression. Fixed on master.

@nnathan
Copy link
Author

nnathan commented Jul 27, 2024

Much appreciated, thanks for the quick turn around. I'll leave it up to you if you want to close the request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants