21 #ifndef __utl_dev_dev_iterators_h__ 22 #define __utl_dev_dev_iterators_h__ 42 template <
typename _Cat,
typename _Tp,
typename _Diff =ptrdiff_t>
68 template <
typename cont_t,
typename data_t>
100 :
owner_ {
const_cast<cont_t*
>(it.owner_)} { }
103 owner_ =
const_cast<cont_t*
>(it.owner_);
127 template <
typename cont_t,
typename data_t>
169 owner_ {
const_cast<cont_t*
>(it.owner_)},
174 owner_ =
const_cast<cont_t*
>(it.owner_);
228 template<
typename _C1,
typename _D1,
typename _C2,
typename _D2>
231 return ((lhs.owner() == rhs.owner()) &&
232 (lhs.value() == rhs.value()) &&
233 (lhs.cursor() == rhs.cursor()));
235 template<
typename _C1,
typename _D1,
typename _C2,
typename _D2>
249 template<
typename cont_t,
typename iter_t, index_t _beg =0, index_t _end =static_cast<index_t>(-1)>
292 owner_ {
const_cast<cont_t*
>(it.owner_)},
296 owner_ =
const_cast<cont_t*
>(it.owner_);
364 template<
typename _Cont1,
typename _It1,
index_t _beg1,
index_t _end1,
368 return ((lhs.cursor() == rhs.cursor()) &&
369 (lhs.owner() == rhs.owner()));
380 template<
typename _Cont1,
typename _It1,
index_t _beg1,
index_t _end1,
384 return !(lhs == rhs);
391 #if defined _utl_have_concepts 393 template <
typename T>
394 concept
bool Outdev_it = requires (T t) {
396 typename T::value_type;
397 typename T::difference_type;
399 typename T::reference;
401 typename T::iterator_category,
402 std::output_iterator_tag
408 {t.owner()} ->auto&&;
412 namespace outdev_it_details {
416 template <
typename _Tp,
typename =
void>
420 template <
typename _Tp>
424 typename _Tp::value_type,
425 typename _Tp::difference_type,
426 typename _Tp::pointer,
427 typename _Tp::reference,
460 template<
typename cont_t,
typename iter_t, index_t _beg =0,
size_t _size = static_cast<
size_t>(-1)-_beg>
511 owner_ {
const_cast<cont_t*
>(it.owner_)},
516 owner_ =
const_cast<cont_t*
>(it.owner_);
604 template<
typename _Cont1,
typename _It1,
index_t _beg1,
size_t _size1,
607 typename _Cont2,
typename _It2,
index_t _beg2,
size_t _size2>
610 return (x.owner() == y.owner() &&
611 (x.cursor() == y.cursor()));
614 template<
typename _Cont1,
typename _It1,
index_t _beg1,
size_t _size1,
615 typename _Cont2,
typename _It2,
index_t _beg2,
size_t _size2>
616 inline bool operator< (const indev_it<_Cont1, _It1, _beg1, _size1>& x,
618 return (x.cursor() < y.cursor());
622 template<
typename _Cont1,
typename _It1,
index_t _beg1,
size_t _size1,
623 typename _Cont2,
typename _It2,
index_t _beg2,
size_t _size2>
628 template<
typename _Cont1,
typename _It1,
index_t _beg1,
size_t _size1,
629 typename _Cont2,
typename _It2,
index_t _beg2,
size_t _size2>
630 inline bool operator<= (const indev_it<_Cont1, _It1, _beg1, _size1>& x,
634 template<
typename _Cont1,
typename _It1,
index_t _beg1,
size_t _size1,
635 typename _Cont2,
typename _It2,
index_t _beg2,
size_t _size2>
640 template<
typename _Cont1,
typename _It1,
index_t _beg1,
size_t _size1,
641 typename _Cont2,
typename _It2,
index_t _beg2,
size_t _size2>
649 template<
typename _Cont1,
typename _It1,
index_t _beg1,
size_t _size1,
650 typename _Cont2,
typename _It2,
index_t _beg2,
size_t _size2>
653 -> decltype (x.cursor() - y.cursor()) {
654 return (x.cursor() - y.cursor());
657 template<
typename _Cont,
typename _It, index_t _beg,
size_t _size>
658 inline indev_it<_Cont, _It, _beg, _size>
668 #if defined _utl_have_concepts 670 template <
typename T>
671 concept
bool Indev_it = requires (T t,
const T ct) {
673 typename T::value_type;
674 typename T::difference_type;
676 typename T::reference;
678 typename T::iterator_category,
679 std::input_iterator_tag
681 {*t} ->
typename T::value_type;
685 {ct.
owner()} ->auto&&;
686 {ct.cursor()} ->
const size_t;
687 {ct.value()} ->
auto&&;
690 namespace indev_it_details {
694 template <
typename _Tp,
typename =
void>
698 template <
typename _Tp>
702 typename _Tp::value_type,
703 typename _Tp::difference_type,
704 typename _Tp::pointer,
705 typename _Tp::reference,
739 template<
typename cont_t,
typename iter_t, index_t _beg =0,
size_t _size = static_cast<
size_t>(-1)-_beg>
801 owner_ {
const_cast<cont_t*
>(it.owner_)},
806 owner_ =
const_cast<cont_t*
>(it.owner_);
889 template<
typename _Cont1,
typename _It1,
index_t _beg1,
size_t _size1,
892 typename _Cont2,
typename _It2,
index_t _beg2,
size_t _size2>
895 return (x.owner() == y.owner() &&
896 (x.cursor() == y.cursor()));
899 template<
typename _Cont1,
typename _It1,
index_t _beg1,
size_t _size1,
900 typename _Cont2,
typename _It2,
index_t _beg2,
size_t _size2>
901 inline bool operator< (const iodev_it<_Cont1, _It1, _beg1, _size1>& x,
903 return (x.cursor() < y.cursor());
907 template<
typename _Cont1,
typename _It1,
index_t _beg1,
size_t _size1,
908 typename _Cont2,
typename _It2,
index_t _beg2,
size_t _size2>
913 template<
typename _Cont1,
typename _It1,
index_t _beg1,
size_t _size1,
914 typename _Cont2,
typename _It2,
index_t _beg2,
size_t _size2>
915 inline bool operator<= (const iodev_it<_Cont1, _It1, _beg1, _size1>& x,
919 template<
typename _Cont1,
typename _It1,
index_t _beg1,
size_t _size1,
920 typename _Cont2,
typename _It2,
index_t _beg2,
size_t _size2>
925 template<
typename _Cont1,
typename _It1,
index_t _beg1,
size_t _size1,
926 typename _Cont2,
typename _It2,
index_t _beg2,
size_t _size2>
934 template<
typename _Cont1,
typename _It1,
index_t _beg1,
size_t _size1,
935 typename _Cont2,
typename _It2,
index_t _beg2,
size_t _size2>
938 -> decltype (x.cursor() - y.cursor()) {
939 return (x.cursor() - y.cursor());
942 template<
typename _Cont,
typename _It, index_t _beg,
size_t _size>
943 inline iodev_it<_Cont, _It, _beg, _size>
953 #if defined _utl_have_concepts 955 template <
typename T>
956 concept
bool Idxdev_it = requires (T t,
const T ct) {
958 typename T::value_type;
959 typename T::difference_type;
961 typename T::reference;
963 typename T::iterator_category,
964 std::input_iterator_tag
966 {*t} ->
typename T::value_type;
970 {ct.
owner()} ->auto&&;
971 {ct.cursor()} ->
const size_t;
972 {ct.value()} ->
auto&&;
975 namespace idxdev_it_details {
979 template <
typename _Tp,
typename =
void>
983 template <
typename _Tp>
987 typename _Tp::value_type,
988 typename _Tp::difference_type,
989 typename _Tp::pointer,
990 typename _Tp::reference,
iterator_t & operator++() noexcept
value_type value_
The current value, used as cache.
indev_it< cont_t, iter_t, _beg, _size > iterator_t
< iterator type local name
value_type v_
Current value buffer to access via get.
reference operator[](difference_type n)
[] operator. Is a combination of input method and dereference
bool operator==(const array< _Tp, _Nm > &lhs, const array< _Tp, _Nm > &rhs)
iterator_t & operator++() noexcept
Pre increment.
reference operator[](difference_type n) noexcept
Random access through iterator.
typename dev_iterator_traits< std::output_iterator_tag, iter_t >::pointer pointer
std::output_iterator_tag iterator_category
typename dev_iterator_traits< std::output_iterator_tag, data_t, void >::iterator_category iterator_category
Cursor
#define-like enumerator for Cursor
Points one place after last item.
istreamdev_it< cont_t, data_t > iterator_t
Iterator tags [std.iterator.tags] Extension: contiguous_iterator_tag for denoting contiguous iterator...
void void_t
void_t type alias
outdev_it() noexcept
Default constructor results to end()
iterator_t & operator-=(difference_type n) noexcept
Random cursor decrement.
Indexed device iterator type. We "future call" interface methods from owner class to provide iterator...
Primary template to catch any non SPI interface types.
ostreamdev_it(const iterator_t &it) noexcept
Basic copy constructor.
typename dev_iterator_traits< std::output_iterator_tag, iter_t >::reference reference
Cursor
#define-like enumerator for Cursor
iterator_t & operator=(const iterator_t &it) noexcept
Basic copy assignment operator.
typename dev_iterator_traits< std::output_iterator_tag, data_t, void >::pointer pointer
index_t cursor_
virtual cursor for comparison operators
iterator_t & operator+=(difference_type n)
const index_t cursor() const noexcept
Export cursor for comparison.
Primary template to catch any non SPI interface types.
typename dev_iterator_traits< std::output_iterator_tag, data_t, void >::value_type value_type
indev_it(cont_t *own, size_t cur=eod) noexcept
Basic constructor.
indev_it< _Cont, _It, _beg, _size > operator+(typename _Cont::difference_type n, indev_it< _Cont, _It, _beg, _size > &it) noexcept
iodev_it(const iterator_t &it) noexcept
Basic copy constructor.
iterator_t & operator=(const iterator_t &it) noexcept
Basic copy assignment operator.
iterator_t & operator--()
Pre decrement.
iterator_t operator-(difference_type n) const noexcept
Subtraction operation.
value_type * operator->() noexcept
typename dev_iterator_traits< std::output_iterator_tag, data_t, void >::value_type value_type
value_type & operator=(const value_type &v)
Cursor
#define-like enumerator for Cursor
reference operator*() noexcept
typename dev_iterator_traits< std::output_iterator_tag, iter_t >::iterator_category iterator_category
Device iterator collection.
typename dev_iterator_traits< std::output_iterator_tag, iter_t >::value_type value_type
typename dev_iterator_traits< std::output_iterator_tag, data_t, void >::difference_type difference_type
iterator_t & operator--() noexcept
Pre decrement.
typename dev_iterator_traits< std::output_iterator_tag, iter_t >::value_type value_type
iterator_t operator-(difference_type n)
outdev_it(cont_t *owner, index_t cursor=eod) noexcept
Basic constructor.
auto operator-(indev_it< _Cont1, _It1, _beg1, _size1 > &x, indev_it< _Cont1, _It1, _beg1, _size1 > &y) noexcept -> decltype(x.cursor() - y.cursor())
Output device iterator type. We "future call" interface methods from owner class to provide iterator ...
typename dev_iterator_traits< std::output_iterator_tag, iter_t >::iterator_category iterator_category
iterator_t & operator*() noexcept
const cont_t * owner() const noexcept
Export container for comparison.
iterator_t & operator-=(difference_type n)
typename dev_iterator_traits< std::output_iterator_tag, data_t, void >::pointer pointer
bool operator>=(const array< _Tp, _Nm > &lhs, const array< _Tp, _Nm > &rhs)
struct utl::iodev_it::value_type_t value_
iterator_t & operator=(const iterator_t &it) noexcept
Basic copy assignment operator.
istreamdev_it(cont_t *owner=nullptr, Cursor cursor=eos) noexcept
Basic constructor.
ostreamdev_it< cont_t, data_t > iterator_t
index_t cursor_
virtual cursor for comparison operators
iterator_t & operator++() noexcept
Primary template to catch any non SPI interface types.
STL's core language concepts.
iodev_it(cont_t *owner, size_t cursor=eod) noexcept
Basic constructor.
pointer operator->() noexcept
Arrow operator. This is where the input method is invoked.
iterator_t & operator++() noexcept
Points the first item (relative address)
Input device iterator type. We "future call" interface methods from owner class to provide iterator f...
typename dev_iterator_traits< std::output_iterator_tag, iter_t >::difference_type difference_type
iodev_it< cont_t, iter_t, _beg, _size > iterator_t
< iterator type local name
reference operator*()
De-reference operator. No end() place dereference check is made.
value_type_t(value_type v=value_type{})
typename dev_iterator_traits< std::output_iterator_tag, data_t, void >::reference reference
index_t cursor_
virtual cursor for comparison operators
bool operator>(const array< _Tp, _Nm > &lhs, const array< _Tp, _Nm > &rhs)
iterator_t & operator+=(difference_type n) noexcept
Random cursor increment.
pointer operator->()
Arrow operator. No end() place dereference check is made.
typename dev_iterator_traits< std::output_iterator_tag, iter_t >::reference reference
const cont_t * owner() const noexcept
Export container for comparison.
ostreamdev_it(cont_t *owner=nullptr) noexcept
Basic constructor.
typename dev_iterator_traits< std::output_iterator_tag, data_t, void >::reference reference
iterator_t & operator=(const iterator_t &it) noexcept
Basic copy assignment operator.
iodev_it() noexcept
Default constructor.
iterator_t operator+(difference_type n)
size_t index_t
index_t and size_t mend to be interchangeable
Points one place after last item.
typename dev_iterator_traits< std::output_iterator_tag, iter_t >::difference_type difference_type
const index_t & cursor() const noexcept
Export cursor for comparison.
indev_it(const iterator_t &it) noexcept
Basic copy constructor.
bool operator!=(const array< _Tp, _Nm > &lhs, const array< _Tp, _Nm > &rhs)
typename dev_iterator_traits< std::output_iterator_tag, iter_t >::difference_type difference_type
iterator_t & operator*() noexcept
value_type & operator*() noexcept
iterator_t & operator=(const iterator_t &it) noexcept
Basic copy assignment operator.
const Cursor cursor() const noexcept
Export cursor for comparison.
outdev_it< cont_t, iter_t, _beg, _end > iterator_t
iterator type local name
const value_type & value() const noexcept
Export value for comparison.
const index_t cursor() const noexcept
Export cursor for comparison.
typename dev_iterator_traits< std::output_iterator_tag, iter_t >::pointer pointer
const cont_t * owner() const noexcept
Export container for comparison.
typename dev_iterator_traits< std::output_iterator_tag, data_t, void >::iterator_category iterator_category
Cursor
#define-like enumerator for Cursor-like behavior
indev_it() noexcept
Default constructor.
iterator_t operator+(difference_type n) const noexcept
Addition operation.
Points one place after last item (relative address)
typename dev_iterator_traits< std::output_iterator_tag, data_t, void >::difference_type difference_type
typename dev_iterator_traits< std::output_iterator_tag, iter_t >::iterator_category iterator_category
iterator_t & operator++()
Pre increment.
typename dev_iterator_traits< std::output_iterator_tag, iter_t >::pointer pointer
Implementation detail main forward header.
outdev_it(const iterator_t &it) noexcept
Basic copy constructor.
const cont_t * owner() const noexcept
Export container for comparison.
typename dev_iterator_traits< std::output_iterator_tag, iter_t >::reference reference
typename dev_iterator_traits< std::output_iterator_tag, iter_t >::value_type value_type
istreamdev_it(const iterator_t &it) noexcept
Basic copy constructor.