10USERVER_NAMESPACE_BEGIN
12namespace utils::impl {
14template <
typename Iter>
15struct IteratorWrapper {
19 constexpr auto& operator++() {
24 constexpr std::tuple<
const size_t,
decltype(*iterator)> operator*()
const {
25 return {pos, *iterator};
27 constexpr std::tuple<
const size_t,
decltype(*iterator)> operator*() {
28 return {pos, *iterator};
31 constexpr bool operator==(
const IteratorWrapper& other)
const {
32 return iterator == other.iterator;
34 constexpr bool operator!=(
const IteratorWrapper& other)
const {
35 return !(iterator == other.iterator);
39template <
typename Container,
40 typename Iter =
decltype(std::begin(std::declval<Container>())),
41 typename =
decltype(std::end(std::declval<Container>()))>
42struct ContainerWrapper {
43 using Iterator = IteratorWrapper<Iter>;
46 constexpr auto begin() {
return Iterator{std::begin(container), 0}; }
47 constexpr auto end() {
return Iterator{std::end(container), 0}; }
48 constexpr auto begin()
const {
return Iterator{std::begin(container), 0}; }
49 constexpr auto end()
const {
return Iterator{std::end(container), 0}; }
64template <
typename Container>
66 return impl::ContainerWrapper<Container>{std::forward<Container>(iterable)};