1#ifndef LIBSBX_MEMORY_ITERABLE_ADAPTOR_HPP_
2#define LIBSBX_MEMORY_ITERABLE_ADAPTOR_HPP_
9template<std::forward_iterator Iterator, std::sentinel_for<Iterator> Sentinel = Iterator>
14 using value_type =
typename std::iterator_traits<Iterator>::value_type;
15 using iterator = Iterator;
16 using sentinel = Sentinel;
18 constexpr iterable_adaptor()
noexcept(std::is_nothrow_default_constructible_v<iterator> && std::is_nothrow_default_constructible_v<sentinel>)
22 constexpr iterable_adaptor(iterator from, sentinel to)
noexcept(std::is_nothrow_move_constructible_v<iterator> && std::is_nothrow_move_constructible_v<sentinel>)
23 : _first{std::move(from)},
24 _last{std::move(to)} { }
26 [[nodiscard]]
constexpr auto begin()
const noexcept -> iterator {
30 [[nodiscard]]
constexpr auto end()
const noexcept -> sentinel {
34 [[nodiscard]]
constexpr auto cbegin()
const noexcept -> iterator {
38 [[nodiscard]]
constexpr auto cend()
const noexcept -> sentinel {
49template<
typename Type>
54 using value_type = Type;
55 using pointer = Type *;
56 using reference = Type &;
58 constexpr input_iterator_pointer(value_type&& value)
noexcept(std::is_nothrow_move_constructible_v<value_type>)
59 : _value{std::move(value)} {}
61 [[nodiscard]]
constexpr auto operator->()
noexcept -> pointer {
62 return std::addressof(_value);
65 [[nodiscard]]
constexpr auto operator*()
noexcept -> reference {
Definition: iterable_adaptor.hpp:10