trying zip

v1
Brett 2024-09-30 18:57:15 -04:00
parent 4bdaa3481b
commit 22c44ca551
3 changed files with 18 additions and 5 deletions

View File

@ -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)

View File

@ -227,8 +227,10 @@ namespace blt::iterator
};
}
template<typename IterBase>
class iterator_container : public impls::take_t<iterator_container<IterBase>>, public impls::skip_t<iterator_container<IterBase>>
template<typename IterBase, typename... Base>
class iterator_container : public impls::take_t<iterator_container<IterBase, Base...>>,
public impls::skip_t<iterator_container<IterBase, Base...>>,
public Base ...
{
public:
using iterator_category = typename IterBase::iterator_category;
@ -245,8 +247,7 @@ namespace blt::iterator
static_assert((std::is_same_v<typename IterBase::iterator_category, std::bidirectional_iterator_tag> ||
std::is_same_v<typename IterBase::iterator_category, std::random_access_iterator_tag>),
".rev() must be used with bidirectional (or better) iterators!");
return iterator_container<std::reverse_iterator<IterBase>>{std::reverse_iterator<IterBase>{end()},
std::reverse_iterator<IterBase>{begin()}};
return iterator_container < std::reverse_iterator<IterBase>, Base...>{std::reverse_iterator<IterBase>{end()}, std::reverse_iterator<IterBase>{begin()}};
}
auto begin() const

View File

@ -123,6 +123,18 @@ namespace blt
{}
};
template<typename Derived>
class zip_t
{
public:
template<typename... Iter>
auto zip(iterator_pair<Iter>... iterator_pairs)
{
iterator::iterator_container<iterator::zip_wrapper<Iter...>>(iterator::zip_wrapper<Iter...>{std::move(iterator_pairs.begin)...},
iterator::zip_wrapper<Iter...>{std::move(iterator_pairs.end)...});
}
};
/*
* CTAD for the zip containers
*/