Skip to content

Fastest way to check if initial commit? #14

Answered by JacksonAllan
trapexit asked this question in Q&A
Discussion options

You must be logged in to vote

Hi!

Is the above the best way to do the same with verstable?

Yes, that's the intended usage. It's a bit clunky, but when designing the API, I thought this approach was better than the alternatives (namely returning a struct or requiring users to pass in pointer to a bool even though they might not need this information).

Is the cost of looking up table size 2x sufficiently small to make that a reasonable pattern?

Yes. Verstable tracks the current number of keys currently in the hash table, so the _size function just returns that value. The only reasons that there is a function to retrieve this value are, firstly, API consistency and, secondly, to keep the struct members an implementat…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by trapexit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants