Skip to content

Releases: MarcDirven/cpp-lazy

v8.0.0

23 Mar 15:41
315a94a
Compare
Choose a tag to compare

What's Changed

Full Changelog: v7.0.2...v8.0.0

v7.0.2

11 Feb 15:02
d7635d3
Compare
Choose a tag to compare

Fixed various compiler errors & macro's. Added support for xmake.

v6.0.0

11 Nov 22:10
184909f
Compare
Choose a tag to compare
  • Added CString and ZipLongest includes in Lz.hpp
  • StringSplitter now returns lz::CString if LZ_STANDALONE is defined and std::string_view isn't (3f5f178)
  • Fixed ifndef guards (c9b68db)
  • Function rename from toIterRange to -> chainRange (5a1f487)

CString Iterator & ZipLongest iterator

21 Oct 14:48
42cc850
Compare
Choose a tag to compare

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 as std::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)

08 Sep 16:43
e89a6a0
Compare
Choose a tag to compare

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

29 Aug 16:54
350d80c
Compare
Choose a tag to compare
  • lz::viewRange is now lz::view
  • lz::toIter is now lz::chain
  • lz::rotate is now std::bidirectional_iterator_tag at its best
  • std::format is now std::vformat
  • fmt::format now uses fmt::runtime if C++20 or higher and if {fmt} >= 9.0.0
  • {fmt} version bump to 9.0.0
  • Removed constexpr from lz::JoinWhereIterator because std::mutex is used
  • lz::enumerate is now std::forward_iterator_tag if the iterator passed is std::bidirectional_iterator_tag or lower, still std::random_access_iterator_tag otherwise.
  • Removed all custom lz::next and lz::distance implementations
  • Added fmt::formatter for all lz iterators
  • lz::take, lz::drop and lz::slice are deleted, use lz::view instead using operator+ or std::next (see examples Take.cpp)
  • Fixed various #includes
  • Removed lz::back implementation where iterator tag = std::forward_iterator_tag.
  • lz::valuesRange is now lz::values, this also counts for lz::keysRange
  • lz::cartesian no longer is std::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

24 Jul 10:04
371f9ef
Compare
Choose a tag to compare
  • A new parameter has been added to join, strJoin and toString() 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 just to<std::list>(args...).
  • Reduced symbol sizes by if constexpr and enable if
  • Removed reference from reference typedef in lz::range
  • Added std::decay in to<> 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 and transformTo that copies/transforms the current view inside the given output iterator.

Constexpr & template parameter for `split`

04 Jul 23:04
Compare
Choose a tag to compare

In this release:

  • Iterators have become constexpr compatible if one uses C++20, because the iterators of dynamic containers such as std::vector::begin are only constexpr 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) (previously lz::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 been char, but it was std::string causing a compilation error.
  • Minor docs change.

Version 3.0.0

12 Jun 12:40
81af429
Compare
Choose a tag to compare

New iterator:

  • exclude which excludes a range of [from, to) within a range

Breaking changes:

  • Removed transformAccumulate & strReplace 2e4bbc7
  • Changed function names from firstOrDefault to findFirstOrDefault and its quivalents (lastOrDefault, lastOrDefaultIf etc)
  • Removed toString parallel overload, since parallelizing toString is much more slower than sequenced benchmark showed.
  • Removed concatAsStringView
  • groupBy, except, unique and joinWhere 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 value
  • flatten overload with two iterators as parameter has been renamed to flattenRange
  • nth in lz::IterView has been renamed to next
  • length in lz::IterView has been renamed to distance

Compile error / bug fix / improvements:

  • The function given as parameter within toMap and toUnorderedMap can now have reference parameter instead of const& 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 with std::common_type_t
  • Added standalone support without fmt library using LZ_STANDALONE macro (and/or CMake option)
  • Fixed std::to_string with char (and bool), which would return the integral value of the char instead of e.g. "a"
  • Minor optimizations for toString() when the underlying type is char
  • Added [[nodiscard]] for C++17
  • Added constexpr where possible for C++14, 17 and even 20 for constexpr std::string and algorithms
  • Added .clang-format
  • Added noexcept where possible
  • Added mutable at lz::repeat and FunctionContiner to prevent const only parameters/variables
  • Added parentheses to prevent max macro from Windows.h to cause weird errors
  • Added transparent functors (std::less<> instead of std::less<T>) when C++ is higher than 11
  • Added std::string_view for toString 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 by distance(begin, end) or next(begin, amount)
  • If std::string_view does not exist and LZ_STANDALONE is not defined, fmt::string_view is used in lz::StringSplitter::value_type
  • lz::StringSplitter now has a char overload too (instead of just std::string)
  • Added a lz::strJoin function which does essentialy the same as lz::join(seq, ", ").toString();
  • Removed #include <functional> if C++11 is defined. std::bind was used before but now std::find_if_not is its replacement
  • StringSplitter now takes a const& to a string, instead of &, an additional std::string&& overload has been explicitly deleted
  • Added mean and median methods to lz::IterView in Lz.hpp
  • Added container.reserve calls in lz::BasicIteratorView if container has a method named reserve
  • Added forwarding references in to(Unordered)Map
  • JoinWhereIterator now uses std::find_if instead of "manual" while loop, therefore, it also has an std::execution overload (if C++17 or higher is used)
  • Added constexpr where possible (even for C++20 where dynamic containers such as std::string are constexpr and constexpr algorithms)
  • Added a struct Dimensions that returns the amount of dimensions an iterator has. For example lz::map(vec.begin(), vec.end(), /* ... */); returns 2 if vec is an 1D vector. If C++17, an inline constexpr variable exists for this too.

Bidirectional concat bug fix & bidirectional flatten improvement

16 Mar 15:47
843f94c
Compare
Choose a tag to compare

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...!