trying zip
parent
4bdaa3481b
commit
22c44ca551
|
@ -1,6 +1,6 @@
|
||||||
cmake_minimum_required(VERSION 3.20)
|
cmake_minimum_required(VERSION 3.20)
|
||||||
include(cmake/color.cmake)
|
include(cmake/color.cmake)
|
||||||
set(BLT_VERSION 1.1.4)
|
set(BLT_VERSION 1.1.5)
|
||||||
|
|
||||||
set(BLT_TARGET BLT)
|
set(BLT_TARGET BLT)
|
||||||
|
|
||||||
|
|
|
@ -227,8 +227,10 @@ namespace blt::iterator
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename IterBase>
|
template<typename IterBase, typename... Base>
|
||||||
class iterator_container : public impls::take_t<iterator_container<IterBase>>, public impls::skip_t<iterator_container<IterBase>>
|
class iterator_container : public impls::take_t<iterator_container<IterBase, Base...>>,
|
||||||
|
public impls::skip_t<iterator_container<IterBase, Base...>>,
|
||||||
|
public Base ...
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
using iterator_category = typename IterBase::iterator_category;
|
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> ||
|
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>),
|
std::is_same_v<typename IterBase::iterator_category, std::random_access_iterator_tag>),
|
||||||
".rev() must be used with bidirectional (or better) iterators!");
|
".rev() must be used with bidirectional (or better) iterators!");
|
||||||
return iterator_container<std::reverse_iterator<IterBase>>{std::reverse_iterator<IterBase>{end()},
|
return iterator_container < std::reverse_iterator<IterBase>, Base...>{std::reverse_iterator<IterBase>{end()}, std::reverse_iterator<IterBase>{begin()}};
|
||||||
std::reverse_iterator<IterBase>{begin()}};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
auto begin() const
|
auto begin() const
|
||||||
|
|
|
@ -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
|
* CTAD for the zip containers
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue