Releases: Kaaserne/cpp-lazy
Releases · Kaaserne/cpp-lazy
v8.0.0
What's Changed
- Partial module support - GenerateWhile iterator by @MarcDirven in #147
- Test update Catch2 by @MarcDirven in #148
- Removed security issue by @MarcDirven in #149
- Exclusive scan iterator & code improvements by @MarcDirven in #150
- Inclusive scan by @MarcDirven in #151
- Removed type alias in template by @MarcDirven in #152
- forEachWhile & CI fix by @MarcDirven in #153
Full Changelog: v7.0.2...v8.0.0
v7.0.2
v6.0.0
CString Iterator & ZipLongest iterator
This release, two new iterators have been released:
- Zip longest, used to iterate over multiple containers, and stops when the longest container is at its end. If C++17, it uses
std::optional
, otherwise, it uses an internal optional, with the same syntax & basic functions asstd::optional
, so breaking changes are prevented when upgrading to C++17. - C String, used to iterate over a C style string, without having to know its length.
Also a few functions were missing documentation which is now fixed.
5.0.1 (CMake improvements)
CMake has a new target. This target is run when a new release is released. It only selects the bare essentials, that is: headers, LICENSE and CMakeLists.txt and zips this. The zip will be called cpp-lazy-src.zip, and can be downloaded and configured as follows:
# Uncomment this line to use the cpp-lazy standalone version
# set(CPP-LAZY_USE_STANDALONE TRUE)
include(FetchContent)
FetchContent_Declare(cpp-lazy
URL https://github.com/MarcDirven/cpp-lazy/releases/download/<TAG_HERE E.G. 5.0.1>/cpp-lazy-src.zip
# Below is optional
# URL_MD5 <MD5 HASH OF cpp-lazy.zip>
# If using CMake >= 3.24, preferably set <bool> to TRUE
# DOWNLOAD_EXTRACT_TIMESTAMP <bool>
)
FetchContent_MakeAvailable(cpp-lazy)
add_executable(${PROJECT_NAME} main.cpp)
target_link_libraries(${PROJECT_NAME} cpp-lazy::cpp-lazy)
This is great because:
- It no longer downloads files you won't need
- Therefore, it's a smaller directory
- It doesn't pollute the CMake build directory with examples, tests, benchmarks etc...
Also, downloading the library {fmt} also has become a bit faster, since it doesn't use git clone anymore. Instead it uses a faster alternative.
- Fixed a compiler error where zipping with
lz::zip(list, vector)
didn't compile.
5.0.0
lz::viewRange
is nowlz::view
lz::toIter
is nowlz::chain
lz::rotate
is nowstd::bidirectional_iterator_tag
at its beststd::format
is nowstd::vformat
fmt::format
now usesfmt::runtime
if C++20 or higher and if{fmt}
>= 9.0.0{fmt}
version bump to 9.0.0- Removed
constexpr
fromlz::JoinWhereIterator
becausestd::mutex
is used lz::enumerate
is nowstd::forward_iterator_tag
if the iterator passed isstd::bidirectional_iterator_tag
or lower, stillstd::random_access_iterator_tag
otherwise.- Removed all custom
lz::next
andlz::distance
implementations - Added
fmt::formatter
for all lz iterators lz::take
,lz::drop
andlz::slice
are deleted, uselz::view
instead usingoperator+
orstd::next
(see examplesTake.cpp
)- Fixed various
#include
s - Removed
lz::back
implementation where iterator tag =std::forward_iterator_tag
. lz::valuesRange
is nowlz::values
, this also counts forlz::keysRange
lz::cartesian
no longer isstd::random_access_iterator_tag
by default- If the input iterator in
lz::zip
is bidirectional,ZipIterator
will be a forward iterator
Format specifier & fmt 8 support
- A new parameter has been added to
join
,strJoin
andtoString()
to specify the{fmt}
formatting rules. A default value of"{}"
is given, so no syntactic changes. Example:
std::array<double, 4> array = {1.12, 1.12, 1.12, 1.12};
auto str = lz::strJoin(array, ", ", "{:.1f}");
// str == "1.1, 1.1, 1.1, 1.1"
// or
for (std::string s : lz::join(array, ", ", "{:.1f}") {
// do something with s
}
- Added extra
to<>
overload, that enables:to<std::list<int>>(args...)
instead of justto<std::list>(args...)
. - Reduced symbol sizes by
if constexpr
andenable if
- Removed reference from
reference
typedef inlz::range
- Added
std::decay
into<>
container type, which would normally cause a compile error - Fixed CMake lz standalone issues
- Fixed a move that did not do anything 9ae8ec0
{fmt}
version 8 support- Added member methods:
copyTo
andtransformTo
that copies/transforms the current view inside the given output iterator.
Constexpr & template parameter for `split`
In this release:
- Iterators have become
constexpr
compatible if one uses C++20, because the iterators of dynamic containers such asstd::vector::begin
are onlyconstexpr
if C++20 is used (and the compiler has enough support for this). - The function
lz::split<SubString, std::string_view, char>(const std::string_view&, char delimiter)
(previouslylz::split<SubString, std::string_view, std::string>(const std::string_view&, char delimiter)
) has been fixed. Its delimiter to search for was set wrong, it should've beenchar
, but it wasstd::string
causing a compilation error. - Minor docs change.
Version 3.0.0
New iterator:
exclude
which excludes a range of [from, to) within a range
Breaking changes:
- Removed
transformAccumulate
&strReplace
2e4bbc7 - Changed function names from
firstOrDefault
tofindFirstOrDefault
and its quivalents (lastOrDefault
,lastOrDefaultIf
etc) - Removed
toString
parallel overload, since parallelizingtoString
is much more slower than sequenced benchmark showed. - Removed
concatAsStringView
groupBy
,except
,unique
andjoinWhere
now need to be sorted beforehand before passing them to its creator functions (lz::except
,lz::groupBy
etc...)groupBy
can now group by a custom predicate instead of a selector valueflatten
overload with two iterators as parameter has been renamed toflattenRange
nth
inlz::IterView
has been renamed tonext
length
inlz::IterView
has been renamed todistance
Compile error / bug fix / improvements:
- The function given as parameter within
toMap
andtoUnorderedMap
can now have reference parameter instead ofconst&
only. - Added
std::move
at all places where possible lz::random
now has an extra overload which can take different random generators/distributions as parameters- Replaced all
LowestIterTypeT
's withstd::common_type_t
- Added standalone support without fmt library using
LZ_STANDALONE
macro (and/or CMake option) - Fixed
std::to_string
withchar
(andbool
), which would return the integral value of the char instead of e.g."a"
- Minor optimizations for
toString()
when the underlying type ischar
- Added
[[nodiscard]]
for C++17 - Added
constexpr
where possible for C++14, 17 and even 20 for constexprstd::string
and algorithms - Added
.clang-format
- Added
noexcept
where possible - Added
mutable
atlz::repeat
andFunctionContiner
to preventconst
only parameters/variables - Added parentheses to prevent
max
macro fromWindows.h
to cause weird errors - Added transparent functors (
std::less<>
instead ofstd::less<T>
) when C++ is higher than 11 - Added
std::string_view
fortoString
as its delimiter - Some of the forward iterators now have a custom distance/next implementation. Enabling this would require:
using lz::distance/next; using std::distance/next
followed bydistance(begin, end)
ornext(begin, amount)
- If
std::string_view
does not exist andLZ_STANDALONE
is not defined,fmt::string_view
is used inlz::StringSplitter::value_type
lz::StringSplitter
now has achar
overload too (instead of juststd::string
)- Added a
lz::strJoin
function which does essentialy the same aslz::join(seq, ", ").toString();
- Removed
#include <functional>
if C++11 is defined.std::bind
was used before but nowstd::find_if_not
is its replacement StringSplitter
now takes aconst&
to a string, instead of&
, an additionalstd::string&&
overload has been explicitly deleted- Added
mean
andmedian
methods tolz::IterView
inLz.hpp
- Added
container.reserve
calls inlz::BasicIteratorView
ifcontainer
has a method namedreserve
- Added forwarding references in
to(Unordered)Map
JoinWhereIterator
now usesstd::find_if
instead of "manual"while
loop, therefore, it also has anstd::execution
overload (if C++17 or higher is used)- Added
constexpr
where possible (even for C++20 where dynamic containers such asstd::string
areconstexpr
andconstexpr
algorithms) - Added a struct
Dimensions
that returns the amount of dimensions an iterator has. For examplelz::map(vec.begin(), vec.end(), /* ... */);
returns 2 ifvec
is an 1D vector. IfC++17
, aninline constexpr
variable exists for this too.
Bidirectional concat bug fix & bidirectional flatten improvement
Improvements
- a50601d Flatten iterator is now bidirectional
- 5a0825f Removed typedef
- af91ef3 Added a decltype
- 7403cdd Edited a static assertion condition
- 069ba7a Removed some dead code
- 4a8bb43 Added extra move semantics
- 6c83aad Added extra explicit template parameter for to container
- 5129308 Removed unnecesary if statement and extra move semantics
- 9b87d2f Extra examples
- 243b525 Added pragma disable warning
- b26a4d7 Removed a reverse iterator bug in concatenate
- cc5d221 Added one liners and removed unecessary import
- b5e57f9 Added mutable fn
- Many more good things...!