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

add function which returns pointer to added element #42

Open
duarm opened this issue Jan 2, 2024 · 0 comments
Open

add function which returns pointer to added element #42

duarm opened this issue Jan 2, 2024 · 0 comments
Labels
feature request Feature requests

Comments

@duarm
Copy link

duarm commented Jan 2, 2024

Feature Request Template

What is the nature of this request?

  • New functionalities

Is your feature request related to a problem? Please describe.

Currently, if you want to add an element then get it's reference, you need to first call _push_back, then _get_ref(_count(list) - 1), _back returns a copy, so we can't use that. This is quite verbose.

Describe the solution you'd like

it would be useful if we had an _push_back_ref, function, which is like _push_back, but it returns the pointer instead of a bool.

Maybe a _back_ref

Not sure if expanding the API surface is worth it, but it might be worth considering.

@duarm duarm added the feature request Feature requests label Jan 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Feature requests
Projects
None yet
Development

No branches or pull requests

1 participant