enumerate on arrays

v1
Brett 2024-07-21 18:46:15 -04:00
parent cd5c98d748
commit 27d1b94493
3 changed files with 14 additions and 2 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.18.10) set(BLT_VERSION 0.18.11)
set(BLT_TEST_VERSION 0.0.1) set(BLT_TEST_VERSION 0.0.1)
set(BLT_TARGET BLT) set(BLT_TARGET BLT)

View File

@ -163,6 +163,18 @@ namespace blt
return enumerator{container.begin(), container.end()}; return enumerator{container.begin(), container.end()};
} }
template<typename T, blt::size_t size>
static inline auto enumerate(const T(&container)[size])
{
return enumerator{&container[0], &container[size]};
}
template<typename T, blt::size_t size>
static inline auto enumerate(T(&container)[size])
{
return enumerator{&container[0], &container[size]};
}
template<typename T> template<typename T>
static inline auto enumerate(T& container) static inline auto enumerate(T& container)
{ {

@ -1 +1 @@
Subproject commit 8a889d3699b3c09ade435641fb034427f3fd12b6 Subproject commit d88c5e15079047777b418132ece5879e7c9aaa2b