12 template<
class T,
class traits_t>
13 constexpr generic_span<T, traits_t>::iterator::iterator(generator_type generator, size_type nIndex) noexcept
14 : m_Generator(std::move(generator))
19 template<
class T,
class traits_t>
20 constexpr
typename generic_span<T, traits_t>::iterator::reference generic_span<T, traits_t>::iterator::operator*()
23 auto generator = m_Generator;
27 template<
class T,
class traits_t>
28 constexpr
typename generic_span<T, traits_t>::iterator::pointer generic_span<T, traits_t>::iterator::operator->()
31 auto generator = m_Generator;
35 template<
class T,
class traits_t>
36 constexpr
typename generic_span<T, traits_t>::iterator& generic_span<T, traits_t>::iterator::operator++() noexcept
40 if (operator->() !=
nullptr)
46 m_Generator =
nullptr;
47 m_nIndex = std::numeric_limits<size_type>::max();
53 template<
class T,
class traits_t>
54 constexpr
typename generic_span<T, traits_t>::iterator generic_span<T, traits_t>::iterator::operator++(
int) noexcept
61 template<
class T,
class traits_t>
62 constexpr
bool generic_span<T, traits_t>::iterator::operator!=(
const iterator& r)
const noexcept
64 return !operator==(r);
67 template<
class T,
class traits_t>
68 constexpr
bool generic_span<T, traits_t>::iterator::operator==(
const iterator& r)
const noexcept
70 return m_nIndex == r.m_nIndex;
73 template<
class T,
class traits_t>
74 constexpr generic_span<T, traits_t>::iterator::operator
void*()
const noexcept
76 auto generator = m_Generator;
80 template<
class T,
class traits_t>
81 template<
class container_t>
84 container.begin() != container.end()
85 ? [it = container.begin(), &container]()
mutable
89 if (it != container.end())
91 pRet = it.operator->();
97 : generator_type(
nullptr))
101 template<
class T,
class traits_t>
102 template<
class container_t>
104 container_t& container,
105 function_type<reference(qualified_type<container_value<container_t>>&)> valueAdapter) noexcept
106 : m_InitialGenerator(create_initial_generator(container, std::move(valueAdapter)))
110 template<
class T,
class traits_t>
111 template<
class container_t>
118 template<
class T,
class traits_t>
121 return !
static_cast<bool>(m_InitialGenerator);
124 template<
class T,
class traits_t>
127 return m_InitialGenerator ?
iterator(m_InitialGenerator, 0) : end();
130 template<
class T,
class traits_t>
133 return iterator(
nullptr, std::numeric_limits<typename iterator::size_type>::max());
136 template<
class T,
class traits_t>
142 template<
class T,
class traits_t>
148 template<
class T,
class traits_t>
149 template<
class container_t,
class adapter_t>
151 container_t&& container,
152 adapter_t adapter) noexcept
154 return container.
begin() != container.end()
155 ? [it = container.begin(), _adapter = std::move(adapter), &container]()
mutable
159 if (it != container.end())
161 pRet = &_adapter(*it);
167 : generator_type(
nullptr);
Same as std::span, but may be used with containers with forward iterators.
generic_span & operator=(container_t &container) noexcept
operator=
iterator cend() const noexcept
Return const iterator to end.
iterator end() const noexcept
Return iterator to end.
iterator begin() const noexcept
Return iterator to beginning.
bool empty() const noexcept
Check if span is empty.
iterator cbegin() const noexcept
Return const iterator to beginning.