From 22c44ca551ecaf4c85278c310a14163d97096fc7 Mon Sep 17 00:00:00 2001 From: Brett Laptop Date: Mon, 30 Sep 2024 18:57:15 -0400 Subject: [PATCH] trying zip --- CMakeLists.txt | 2 +- include/blt/iterator/common.h | 9 +++++---- include/blt/iterator/zip.h | 12 ++++++++++++ 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 014dc94..0bf31e4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.20) include(cmake/color.cmake) -set(BLT_VERSION 1.1.4) +set(BLT_VERSION 1.1.5) set(BLT_TARGET BLT) diff --git a/include/blt/iterator/common.h b/include/blt/iterator/common.h index a415a78..1474017 100644 --- a/include/blt/iterator/common.h +++ b/include/blt/iterator/common.h @@ -227,8 +227,10 @@ namespace blt::iterator }; } - template - class iterator_container : public impls::take_t>, public impls::skip_t> + template + class iterator_container : public impls::take_t>, + public impls::skip_t>, + public Base ... { public: using iterator_category = typename IterBase::iterator_category; @@ -245,8 +247,7 @@ namespace blt::iterator static_assert((std::is_same_v || std::is_same_v), ".rev() must be used with bidirectional (or better) iterators!"); - return iterator_container>{std::reverse_iterator{end()}, - std::reverse_iterator{begin()}}; + return iterator_container < std::reverse_iterator, Base...>{std::reverse_iterator{end()}, std::reverse_iterator{begin()}}; } auto begin() const diff --git a/include/blt/iterator/zip.h b/include/blt/iterator/zip.h index 4a04d41..bb05bda 100644 --- a/include/blt/iterator/zip.h +++ b/include/blt/iterator/zip.h @@ -123,6 +123,18 @@ namespace blt {} }; + template + class zip_t + { + public: + template + auto zip(iterator_pair... iterator_pairs) + { + iterator::iterator_container>(iterator::zip_wrapper{std::move(iterator_pairs.begin)...}, + iterator::zip_wrapper{std::move(iterator_pairs.end)...}); + } + }; + /* * CTAD for the zip containers */