Skip to content

Conversation

@Carlos-Mero
Copy link

The original implementation of kvec.h is quite old (the last modification is even 12 years before) and lacks a bunch of functionalities. So I made some improvements to the source code.

  • I added a statement to kv_resize so that it can correctly handle the changes of (v).n while resizing.
  • I added two macros kv_insert and kv_remove as dynamic operations on the vector. They are some basic operations adopted by STL in C++ and other implementations of vector.
  • The original kv_pop method didn't decrease the capability of the vector, which could cause memory waste in some cases. So I defined another macro called kv_p to address this problem. The macro kv_pop is kept unchanged for capability, and it can be used for better performance.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant