ranges!
parent
57ddcfca1e
commit
4776546e35
|
@ -1,7 +1,7 @@
|
|||
cmake_minimum_required(VERSION 3.20)
|
||||
include(cmake/color.cmake)
|
||||
|
||||
set(BLT_VERSION 0.17.27)
|
||||
set(BLT_VERSION 0.17.28)
|
||||
set(BLT_TEST_VERSION 0.0.1)
|
||||
|
||||
set(BLT_TARGET BLT)
|
||||
|
|
|
@ -19,6 +19,27 @@ namespace blt
|
|||
{
|
||||
namespace itr
|
||||
{
|
||||
template<typename ITER>
|
||||
class itr_container
|
||||
{
|
||||
public:
|
||||
itr_container(ITER&& begin, ITER&& end): begin_(std::forward<ITER>(begin)), end_(std::forward<ITER>(end))
|
||||
{}
|
||||
|
||||
ITER begin()
|
||||
{
|
||||
return begin_;
|
||||
}
|
||||
|
||||
ITER end()
|
||||
{
|
||||
return end_;
|
||||
}
|
||||
|
||||
private:
|
||||
ITER begin_, end_;
|
||||
};
|
||||
|
||||
template<typename TYPE_ITR, bool is_ptr = std::is_pointer_v<TYPE_ITR>>
|
||||
class iterator;
|
||||
|
||||
|
@ -153,6 +174,12 @@ namespace blt
|
|||
return enumerator{container.begin(), container.end()};
|
||||
}
|
||||
|
||||
template<typename ITER>
|
||||
static inline auto enumerate(ITER&& begin, ITER&& end)
|
||||
{
|
||||
return itr::itr_container<ITER>{std::forward<ITER>(begin), std::forward<ITER>(end)};
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
struct range
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue