v1
Brett 2024-07-02 12:57:51 -04:00
parent 57ddcfca1e
commit 4776546e35
2 changed files with 28 additions and 1 deletions

View File

@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.20) cmake_minimum_required(VERSION 3.20)
include(cmake/color.cmake) 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_TEST_VERSION 0.0.1)
set(BLT_TARGET BLT) set(BLT_TARGET BLT)

View File

@ -19,6 +19,27 @@ namespace blt
{ {
namespace itr 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>> template<typename TYPE_ITR, bool is_ptr = std::is_pointer_v<TYPE_ITR>>
class iterator; class iterator;
@ -153,6 +174,12 @@ namespace blt
return enumerator{container.begin(), container.end()}; 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> template<typename T>
struct range struct range
{ {