C-Macro-Collections icon indicating copy to clipboard operation
C-Macro-Collections copied to clipboard

add function which returns pointer to added element

Open duarm opened this issue 1 year ago • 0 comments

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 avatar Jan 02 '24 15:01 duarm