Thoth
A functional, expressive, asynchronous C++26 webdev library
Loading...
Searching...
No Matches
SharedInputView.hpp
Go to the documentation of this file.
1#pragma once
2#include <ranges>
3#include <memory>
4#include <iterator>
5
6namespace Thoth::Utils {
7 template<std::ranges::input_range Range>
9 struct Iterator {
10 using difference_type = std::ptrdiff_t;
11 using value_type = std::ranges::range_value_t<Range>;
12
14
15 [[nodiscard]] value_type operator*() const;
18 [[nodiscard]] bool operator==(std::default_sentinel_t) const;
19 };
20
21 explicit SharedInputView(Range&& range);
22
24 static std::default_sentinel_t end();
25
26 private:
27 std::ranges::iterator_t<Range> _current;
28 std::ranges::sentinel_t<Range> _end;
29 };
30}
31
32#include <Thoth/Utils/Ranges/SharedInputView.tpp>
33
34namespace Thoth::Utils {
35 static_assert(std::ranges::range<SharedInputView<std::ranges::iota_view<int, int>>>);
36}
Definition Env.hpp:5
Definition SharedInputView.hpp:9
bool operator==(std::default_sentinel_t) const
SharedInputView * view
Definition SharedInputView.hpp:13
std::ptrdiff_t difference_type
Definition SharedInputView.hpp:10
std::ranges::range_value_t< Range > value_type
Definition SharedInputView.hpp:11
Definition SharedInputView.hpp:8
static std::default_sentinel_t end()