A modern, user friendly, generic, type-safe and fast C99 container library: String, Vector, Sorted and Unordered Map and Set, Deque, Forward List, Smart Pointers, Bitset and Random numbers.
Removed all deprecated header files and symbols (retry).
Added (back) c_forfilter (it, C, cnt, filter) as a "loop" variant of c_filter(C, cnt, filter) algorithm.
Added c_foreach_reverse (it, C, cnt), works for vec, deq, stack, queue.
Added reverse and ranged variants to many algorithms: c_foreach, c_filter, c_find_if, c_copy, c_copy_if. The "reverse" variants only works with vec, deq, stack and queue.
Renamed the notoriously bad name "empty" => "is_empty" check for emptyness (as empty() also can also be confused for being an imperative). NOTE: This is a V5.0 breaking change.
- Added c_iota() to algo/crange.h, returning a compound literal that can be iterated directly, e.g. argument to c_filter(). - Updated docs, and some house keeping.
- Improvement in template.h for c_key_class / c_val_class. - Changed name of ranged versions of c_filter() to be num of argument overloads instead of c_filter_in().
Fixed minor flaw in last commit.
- Breaking V5.0 change: cco_yield() => cco_yield, and cco_yield_final() => cco_yield_final; - Reverted to use c_filter_from() API.
Renamed czview => zsview. I suspect this is not much used (yet), so hopefully it should not cause much issues for users.
Removed 'c_auto' macro, and renamed 'c_with' => 'c_scoped' as it is similar to the non-declare variable variant 'c_scope'. c_with is deprecated but available in V5.0.
Removed c_auto and renamed c_with to c_scoped. (c_with still available). Some docs updates.
Two minor fixes for queue and vec.
*Another breaking change for V5.0: - Swapped second and third argument in c_fortoken() to make it consistent with all other c_forxxxx(), i.e, the input object is third/last.**
Added c_filter_zip() and c_filter_pairwise() algorithms: process two ranges/containers at the time or pairwise adjacent elements of one range/container.
Made box and arc have undefined behavior on clone, drop, etc. when they are pointing to NULL. arc_X_use_count() is still defined and returns 0.
Fixes in string_bench_STC.cpp
Added some tests for list.h
Added some tests. Modified c_hash_mix().
Fixed some issues with box.h and arc.h + another small issue in template.h on cloning/from -function. Updated music_arc.c example.
*Updated ctest.h: - Added EXPECT_() tests, as in googletest. - Added aliases to CTEST_ macros: TEST(), TEST_F(), TEST_FIXURE(), TEST_SETUP(), TEST_TEARDOWN(). - Changed to use self in fixures, instead of _self. - Updated tests to use EXPECT_() macros.**
Fixed ctest_print() declaration.
Minor warning fix. Made gcc default in tests/run.sh
Update of some examples. Refactoring in ctest.h
Added a few list tests.
Updated the "extend"-container functionality. Does no longer rely on "container_of". Also added a Cont_ext_clone() function for easy/safe extended container cloning (see example functor.c). Updated list.h the same way to not rely on container_of.
Bump to (c) 2024.
Fixed a bug with i_no_emplace not being set in template.h
Added hmap-robin.h. This may replace hmap.h as it seems faster on all operations. Some refactoring.
Added hmap-robin.h (Robin Hood hashing). This may replace hmap.h as it seems faster in all operations. Some refactoring of current hmap.h and a MSVC fix in common.h.
Updated vikings.c example (advanced): optionally wrap the hashmap key into a smart pointer (box).
Updated godbolt links for coroutines examples.
Improved robin-hood hmap implementation a bit.
Optimized lower_bound/binary_search algorithms.
Maintenance. Replaced i_base with i_container in extend.h (i_base deprecated).
Updated ctest.h API for fixtures.
Update to coroutine.h
Added verstable in the hash map shootout benchmarks.
Several renamings of API symbols, but retained old names as backward compatible.
More renames, finishing last commit.
Renamed c_forlist(...) -> c_foritems(...). Old name is deprecated.
Updated shootout_hashmaps.cpp and small optimization in hmap.h
Small edits in hmap shootout
Internal renaming in hmap.h/robin.h types.h
Fixed regression in hmap_clone (robin-hood). More small changes in hashmap shootout.
Added/changed i_key_str => i_key_cstr AND i_val_str => i_val_cstr. Old i_key_str, i_val_str may still be used.
Internal updates of cstr_lit. Renamed internal "rawclass" type ccharptr => cstr_raw - changed functions to cstr_raw_cmp(), cstr_raw_clone(), etc.
Replaced hmap.h implementation with hmap-robin.h - Robin Hood Hashing.
Reverted c_scoped to c_with. Removed type argument in new typesafe c_swap() function macro.
Removed some "buggy" useless methods in arc.h and box.h Some cleanup, removed vec.h bsearch (use binary_search in algo/quicksort.h).
Minor internal.
Removed stc/extend.h and replaced it with template parameter i_aux. Had to update all clone container functions. Docs updated for i_aux.
Update i_aux docs.
Replaced c_scope and c_defer with setjmp/longjmp based code: added stc/algo/defer.h
Updated c_scope / c_defer docs.
Some minor updates related to defer.h docs etc.
Redid updates for i_aux.
Rewrote defer.h macros: Now uses regular switch only, and very simple and fast!
Added c_scope_max(N) { ... } scope with max defer statements.
Minor cleanup of code and docs for defer.h
DEFER: Added c2_defer and cs_defer to allow 2-level nesting of defer scopes and allow several defer scopes in sequence.
Tiny docs update in defer.h and updated external c++ maps for used for benchmarks.
defer.h: Reverted c1.. to c.. for STC compability.
defer.h: simplified: _defer.state was not needed.
defer.h: increased default number of statements for c_scope to 50, c2_scope/cs_scope to 16.
Improved wording. Set default max defers in c2_scope/cs_scope to 10, because each use 200 bytes (same as all 50 defers in c_scope).
Added .md documentation for defer functionality.
Changed cs_scope => cm_scope. Some docs changes.
More docs and minor cleanups.
Update defer.
Renamed c_scope => c_guard, which is more inline with C defer proposals.
Updated c_with(init, deinit) to support no variable declaration in init.
*- Updated c_return, c2_return, cx_return to evaluate return expression before deferred statements are executed (and removed dangling-if warning). - Now uses non-std but very portable typeof. - Added c_return_typed(TYPE, x) for compilers not supporting typeof.**
defer.h: Renamed c_guard_with_cap(N) => c_guard_max(N). fmt.h: Changed API for printing time.
Added c_panic and c2_panic, updated docs.
Removed c2_break_outer; replaced by c2_panic({});
- Added c_foreach_kv() to replace c_forpair() [deprecated] - Internal house-keeping.
- i_type Name,Key[,Value] now to be used instead of i_TYPE (deprecated). - i_type Name still works when also specifying i_key, (or i_key_cstr etc). - Updated i_foreach_kv macro (replaces i_forpair macro usage).
House keeping.
Refinement in template.h and minor doc/naming improvements in examples.
Simplify: Removed i_tag in the docs. i_type is sufficient. Removed undocumented i_key2.
Simplified: Removed option to specify i_val instead of i_key for non-maps. - Removed undocumented i_keyclass2/i_valclass2.
More cleanup/docs. Added i_cmpclass: defines both i_rawclass and i_use_cmp.
Internal renames. of size/capacity. common.h added: typedef ptrdiff_t isize;
Applied intptr_t => isize (which is ptrdiff_t)
Internal in zsview.h
Renamed _i_self => Self for readability. Is #undef'ed after header inclusion, so will have no typedef Self conflicts. Fixed a minor bug with i_keytoraw called without parens.
Reverted cregex "fix" ; was regression.
Fix for c_formatch / cregex_iter.
Improved template analysis for quicksort.h
House holding. Added optional sort support for stack.
Cleanup and fixes in cstr/csview
Reverted to c_svarg() from c_SVARG(), and added c_svfmt.
Simplify i_cmpclass.
Fixed bug in vec.h macro: _it2_ptr(it1, it2). Formatting code.
Integrated algo/sort.h into vec.h, stack.h and deq.h.
Changed list.h sort from qsort to faster internal quicksort (i_cmp can use i_aux customization as well).
Added algo/crandom.h - will replace crand.h (simpler).
Updated usage/docs of "algo/random.h".
Updated API of crandom.h and added 32-bit support.
Updated crandom.h and docs.
Updated crandom.h and added uniform distr. with new API.
Changes to the new random numbers api. random.h now contains both a crand64 and crand32 set of methods.
random.h fixes.
Bugfix and improvements to fixed size bitsets (cbits.h)
Docs and formatting.
Renamed crand64_state => crand64_rng and crand32_state => crand32_rng
Renamed crange_make(...) => crange_from(...). crange_from(n) now consistent with c_iota(n). Renamed: crand32_make(seed) => crand32_from(seed) crand64_make(seed) => crand64_from(seed)
Changed random.h API. Type crand64_rng => crand64. crand64() => crand64_uint(). Same for crand32.
WAY TOO MUCH COMMITTED: - Moved headers from stc/algo to stc: random.h, crange.h, utility.h filter.h sort.h - Removed old crand.h (replaced by random.h): crand64 / crand32 API. - Fixed a typedef bug in sort.h - Added _put() member to smap.h and hmap.h: Like _insert_or_assign(&m, key, val), but works as _emplace_or_assign(&m, rawkey, rawval) when i_keyraw/i_valraw is defined.
Moved algorithms headers into priv (crange.h, filter.h, utility.h). Include "stc/algorithm.h" instead.
Make crand??_normal() functions optional. Define i_normal_dist before including "stc/random.h".
Reverted to old name schema for functions in common.h
Fixed: cstr and smart pointers should not automatically enable/include searching and sorting for vec/deque/stack. Define i_use_eq and i_use_cmp (or #define i_opt c_use_eq|c_use_cmp) like for all other element types.
Removed crand32_normal_dist() and crand32_normal(). Use 64-bit version.
Updated random.h: Define i_static or i_implement before include to enable normal_dist functions.
Removed c_formatch_sv().
- Made cspan have external linking by default. - Completing comparisons functions in csview and zsview.
Some more cmp csview/zsview additions and docs.
Minor fix in string equal comparisons.
Fix compiler error.
Split utf8 functions into unicode (ucd_prv.c) used for cregex, and upper/lower/case insensitive utf8 string comparison used by strings and views.
Updated cregex API: uses postfix _with instead of overloading on number of parameters.
Update cregex API, final.
Added priv/sort_prv.h to fix stcsingle repos to work.
Reverted c_deferred (...) => to c_defer(...) and updated godbolt.org examples.
Fixed linkage specifications for cregex and csview functions.
Added c_foreach_count(k, it, C, cnt) in common.h
Partly reverted naming of extended cregex functions.
Fixed sort.h include.
Updated cstr to split it into two translation units.
c_forfilter (it, C, cnt, filter)
as a "loop" variant ofc_filter(C, cnt, filter)
algorithm.c_foreach_reverse (it, C, cnt)
, works for vec, deq, stack, queue.self
in fixures, instead of_self
. - Updated tests to use EXPECT_() macros.**i_type Name,Key[,Value]
now to be used instead of i_TYPE (deprecated). -i_type Name
still works when also specifying i_key, (or i_key_cstr etc). - Updatedi_foreach_kv
macro (replaces i_forpair macro usage).