Releases: jkalias/functional_cpp
Releases · jkalias/functional_cpp
1.1.1
Bug fixes, a safety improvement, and performance work since 1.1.0. No source changes are required to upgrade.
Bug fixes
fcpp::set::min()/max()now respect the set's comparator and run in O(1). Previously they usedstd::min_element/std::max_element, which rank byoperator<and could return the wrong element for sets with a custom comparator.fcpp::set::operator[](non-const) no longer fails to compile.fcpp::optional(the pre-C++17 fallback): fixed a memory leak on copy-assignment and a value-loss bug on self-assignment.fcpp::setiterator accessors now declare their return types with the set's comparator, fixing fragile type assumptions for custom-comparator sets.
Safety: consistent precondition checks
- Precondition checks (subscript bounds,
replace_range_at,zipon unequal sizes) are now enforced identically in debug and release builds viastd::abort(). Previously these wereasserts that were compiled out underNDEBUG, so release builds could silently invoke undefined behavior / buffer overflows. index_rangehardened against signed-integer overflow, and itsinvalidsentinel is nowconst.- New opt-out: define
FCPP_NO_PRECONDITION_CHECKSto compile the checks out for hot paths whose inputs are already validated.
Performance
- Eliminated unnecessary container copies across non-mutating operations (
filtered,sorted,removing_*,inserting_*,replacing_range_at,map, and theset/mapequivalents) by moving internal containers into the returned wrapper instead of copying them. insert_backno longer copies the inserted element twice, andset::keys()no longer performs a pessimizing move.
Compatibility
- No public API changes. C++11 and C++17 supported as before.
- Behavior change to note: a precondition violation now reliably terminates the process in release builds (it was undefined behavior before). Code that previously relied on that UB "happening to work" should be reviewed.