dev_iterators.h
Go to the documentation of this file.
#ifndef __utl_dev_dev_iterators_h__
#define __utl_dev_dev_iterators_h__
#include <utl/core/impl.h>
#include <utl/meta/meta.h>
namespace utl {
template <typename _Cat, typename _Tp, typename _Diff =ptrdiff_t>
struct dev_iterator_traits {
using iterator_category = _Cat;
using value_type = _Tp;
using difference_type = _Diff;
using pointer = _Tp*;
using reference = _Tp&;
};
struct output_iterator_tag {};
struct input_iterator_tag {};
struct forward_iterator_tag : input_iterator_tag {};
struct bidirectional_iterator_tag : forward_iterator_tag {};
struct random_access_iterator_tag : bidirectional_iterator_tag {};
struct contiguous_iterator_tag : random_access_iterator_tag {};
/*
* ================ Output device Iterator =================
*/
template <typename cont_t, typename data_t>
class ostreamdev_it {
using iterator_t = ostreamdev_it <cont_t, data_t>;
public:
using type = iterator_t;
public:
using iterator_category = typename dev_iterator_traits <std::output_iterator_tag, data_t, void>::iterator_category;
using value_type = typename dev_iterator_traits <std::output_iterator_tag, data_t, void>::value_type;
using difference_type = typename dev_iterator_traits <std::output_iterator_tag, data_t, void>::difference_type;
using pointer = typename dev_iterator_traits <std::output_iterator_tag, data_t, void>::pointer;
using reference = typename dev_iterator_traits <std::output_iterator_tag, data_t, void>::reference;
private:
cont_t* owner_ {nullptr};
public:
ostreamdev_it (cont_t* owner =nullptr) noexcept
: owner_ {owner} { }
ostreamdev_it (const iterator_t& it) noexcept
: owner_ {const_cast<cont_t*>(it.owner_)} { }
iterator_t& operator= (const iterator_t& it) noexcept {
owner_ = const_cast<cont_t*>(it.owner_);
return *this;
}
public:
iterator_t& operator* () noexcept { return *this; }
iterator_t& operator= (const value_type& value) {
if (owner_ != nullptr)
owner_->put (value);
return *this;
}
iterator_t& operator++ () noexcept { return *this; }
iterator_t& operator++ (int) noexcept { return *this; }
};
template <typename cont_t, typename data_t>
class istreamdev_it {
using iterator_t = istreamdev_it <cont_t, data_t>;
public:
using type = iterator_t;
public:
using iterator_category = typename dev_iterator_traits <std::output_iterator_tag, data_t, void>::iterator_category;
using value_type = typename dev_iterator_traits <std::output_iterator_tag, data_t, void>::value_type;
using difference_type = typename dev_iterator_traits <std::output_iterator_tag, data_t, void>::difference_type;
using pointer = typename dev_iterator_traits <std::output_iterator_tag, data_t, void>::pointer;
using reference = typename dev_iterator_traits <std::output_iterator_tag, data_t, void>::reference;
enum Cursor {
init = 0,
valid = 1,
eos = 2
};
private:
cont_t* owner_ {nullptr};
value_type value_ {};
Cursor cursor_ {init};
public:
istreamdev_it (cont_t* owner =nullptr, Cursor cursor =eos) noexcept :
owner_ {owner},
value_ {},
cursor_{cursor} { }
istreamdev_it (const iterator_t& it) noexcept :
owner_ {const_cast<cont_t*>(it.owner_)},
value_ {it.value_},
cursor_ {it.cursor_} { }
iterator_t& operator= (const iterator_t& it) noexcept {
owner_ = const_cast<cont_t*>(it.owner_);
value_ = it.value_;
cursor_ = it.cursor_;
return *this;
}
public:
value_type& operator* () noexcept {
if (cursor_ == init)
++*this;
return value_;
}
value_type* operator->() noexcept {
if (cursor_ == init)
++*this;
return &value_;
}
iterator_t& operator++ () noexcept {
_get(value_);
return *this;
}
iterator_t operator++ (int) noexcept {
iterator_t r = *this;
_get(value_);
return r;
}
const cont_t* owner () const noexcept { return owner_; }
const value_type& value () const noexcept { return value_; }
const Cursor cursor () const noexcept { return cursor_; }
private:
void _get(value_type& v) {
owner_->get(v);
cursor_ = (v) ? valid : eos;
}
};
template<typename _C1, typename _D1, typename _C2, typename _D2>
inline bool operator== (const istreamdev_it<_C1, _D1>& lhs,
const istreamdev_it<_C2, _D2>& rhs) noexcept {
return ((lhs.owner() == rhs.owner()) &&
(lhs.value() == rhs.value()) &&
(lhs.cursor() == rhs.cursor()));
}
template<typename _C1, typename _D1, typename _C2, typename _D2>
inline bool operator!= (const istreamdev_it<_C1, _D1>& lhs,
const istreamdev_it<_C2, _D2>& rhs) noexcept {
return !operator==(lhs, rhs);
}
template<typename cont_t, typename iter_t, index_t _beg =0, index_t _end =static_cast<index_t>(-1)>
class outdev_it {
using iterator_t = outdev_it <cont_t, iter_t, _beg, _end>;
public:
using type = iterator_t;
public:
using iterator_category = typename dev_iterator_traits <std::output_iterator_tag, iter_t>::iterator_category;
using value_type = typename dev_iterator_traits <std::output_iterator_tag, iter_t>::value_type;
using difference_type = typename dev_iterator_traits <std::output_iterator_tag, iter_t>::difference_type;
using pointer = typename dev_iterator_traits <std::output_iterator_tag, iter_t>::pointer;
using reference = typename dev_iterator_traits <std::output_iterator_tag, iter_t>::reference;
enum Cursor {
beg = _beg,
eod = _end,
};
private:
cont_t* owner_ {nullptr};
index_t cursor_ {eod};
public:
explicit outdev_it() noexcept :
owner_ {nullptr},
cursor_{eod} { }
explicit outdev_it (cont_t* owner, index_t cursor =eod) noexcept :
owner_ {owner},
cursor_{cursor} { }
explicit outdev_it (const iterator_t& it) noexcept :
owner_ {const_cast<cont_t*>(it.owner_)},
cursor_{it.cursor_} { }
iterator_t& operator= (const iterator_t& it) noexcept {
owner_ = const_cast<cont_t*>(it.owner_);
cursor_ = it.cursor_;
}
// template<typename _It>
// outdev_it (const outdev_it<
// use_if_same_t <_It, typename container_t::pointer_type, container_t>,
// _It,
// streamsize
// >& it) noexcept
// : owner_ {const_cast<container_t*>(it.owner())},
// cursor_ {it.cursor()} { }
public:
iterator_t& operator* () noexcept { return *this; }
iterator_t& operator= (const value_type& value) {
// end() and default constructible iterators are not dereferenceable
if (cursor_ != eod)
owner_->put (value, cursor_);
return *this;
}
iterator_t& operator++ () noexcept {
++cursor_;
return *this;
}
iterator_t operator++ (int) noexcept {
iterator_t ret = *this;
++cursor_;
return ret;
}
const cont_t* owner () const noexcept { return owner_; }
const index_t cursor () const noexcept { return cursor_; }
};
template<typename _Cont1, typename _It1, index_t _beg1, index_t _end1,
typename _Cont2, typename _It2, index_t _beg2, index_t _end2>
inline bool operator== (const outdev_it<_Cont1, _It1, _beg1, _end1>& lhs,
const outdev_it<_Cont2, _It2, _beg2, _end2>& rhs) noexcept {
return ((lhs.cursor() == rhs.cursor()) &&
(lhs.owner() == rhs.owner()));
}
template<typename _Cont1, typename _It1, index_t _beg1, index_t _end1,
typename _Cont2, typename _It2, index_t _beg2, index_t _end2>
inline bool operator!= (const outdev_it<_Cont1, _It1, _beg1, _end1>& lhs,
const outdev_it<_Cont2, _It2, _beg2, _end2>& rhs) noexcept {
return !(lhs == rhs);
}
#if defined _utl_have_concepts
template <typename T>
concept bool Outdev_it = requires (T t) {
// STL compatibility
typename T::value_type;
typename T::difference_type;
typename T::pointer;
typename T::reference;
requires same_<
typename T::iterator_category,
std::output_iterator_tag
>::value;
{*t} -> auto&&; // is dereferencable, and return non-void
{++t} -> T&; // is incrementable
{t++} -> T;
// Extras
{t.owner()} ->auto&&;
{t.cursor()} -> size_t;
};
#else
namespace outdev_it_details {
using std::declval;
template <typename _Tp, typename =void>
struct is_outdev_it_ : meta::false_ {};
template <typename _Tp>
struct is_outdev_it_ <
_Tp,
meta::void_t <
typename _Tp::value_type,
typename _Tp::difference_type,
typename _Tp::pointer,
typename _Tp::reference,
// meta::use_if_same_t <
// typename _Tp::iterator_category,
// std::output_iterator_tag
// >
void
>
> : meta::true_ {};
}
// template <typename _Tp>
// constexpr bool Outdev_it = outdev_it_details::is_outdev_it_<_Tp>::value;
#endif
/*
* ================ Input device Iterator =================
*/
template<typename cont_t, typename iter_t, index_t _beg =0, size_t _size = static_cast<size_t>(-1)-_beg>
class indev_it {
using iterator_t = indev_it <cont_t, iter_t, _beg, _size>;
public:
using type = iterator_t;
public:
using iterator_category = typename dev_iterator_traits <std::output_iterator_tag, iter_t>::iterator_category;
using value_type = typename dev_iterator_traits <std::output_iterator_tag, iter_t>::value_type;
using difference_type = typename dev_iterator_traits <std::output_iterator_tag, iter_t>::difference_type;
using pointer = typename dev_iterator_traits <std::output_iterator_tag, iter_t>::pointer;
using reference = typename dev_iterator_traits <std::output_iterator_tag, iter_t>::reference;
enum Cursor {
beg = _beg,
eod = _beg + _size,
};
private:
cont_t* owner_{nullptr};
index_t cursor_{eod};
value_type value_ {};
public:
indev_it () noexcept :
owner_ {nullptr},
cursor_{eod},
value_ {} { }
explicit indev_it (cont_t* own, size_t cur =eod) noexcept :
owner_ {own},
cursor_{cur},
value_ {} { }
explicit indev_it (const iterator_t& it) noexcept :
owner_ {const_cast<cont_t*>(it.owner_)},
cursor_{it.cursor_},
value_ {it.value_} { }
iterator_t& operator= (const iterator_t& it) noexcept {
owner_ = const_cast<cont_t*>(it.owner_);
cursor_ = it.cursor_;
value_ = it.value_;
}
// template<typename _It>
// indev_it (const indev_it<
// use_if_same_t <_It, typename container_t::pointer_type, container_t>,
// _It,
// streamsize
// >& it) noexcept
// : owner_ {const_cast<container_t*>(it.owner())},
// cursor_{it.cursor()},
// value_ {it.value()} { }
public:
reference operator* () {
owner_->get (value_, cursor_);
return value_;
}
pointer operator-> () {
owner_->get (value_, cursor_);
return &value_;
}
iterator_t& operator++ () {
++cursor_;
return *this;
}
iterator_t operator++ (int) {
iterator_t ret(*this);
++cursor_;
return *this;
}
iterator_t& operator-- () {
--cursor_;
return *this;
}
iterator_t operator-- (int) {
iterator_t ret(*this);
--cursor_;
return *this;
}
reference operator[] (difference_type n) {
owner_->get (value_, cursor_ += n);
return value_;
}
iterator_t& operator+= (difference_type n) {
cursor_ += n;
return *this;
}
iterator_t operator+ (difference_type n) {
return iterator_t (owner_, cursor_ + n);
}
iterator_t& operator-= (difference_type n) {
cursor_ -= n;
return *this;
}
iterator_t operator- (difference_type n) {
return iterator_t (owner_, cursor_ - n);
}
const cont_t* owner () const noexcept { return owner_; }
const index_t cursor () const noexcept { return cursor_; }
//const reference value () const noexcept { return value_; }
};
template<typename _Cont1, typename _It1, index_t _beg1, size_t _size1,
typename _Cont2, typename _It2, index_t _beg2, size_t _size2>
inline bool operator== (const indev_it<_Cont1, _It1, _beg1, _size1>& x,
const indev_it<_Cont2, _It2, _beg2, _size2>& y) noexcept {
return (x.owner() == y.owner() &&
(x.cursor() == y.cursor()));
}
template<typename _Cont1, typename _It1, index_t _beg1, size_t _size1,
typename _Cont2, typename _It2, index_t _beg2, size_t _size2>
inline bool operator< (const indev_it<_Cont1, _It1, _beg1, _size1>& x,
const indev_it<_Cont2, _It2, _beg2, _size2>& y) noexcept {
return (x.cursor() < y.cursor());
}
// relative ops
template<typename _Cont1, typename _It1, index_t _beg1, size_t _size1,
typename _Cont2, typename _It2, index_t _beg2, size_t _size2>
inline bool operator!= (const indev_it<_Cont1, _It1, _beg1, _size1>& x,
const indev_it<_Cont2, _It2, _beg2, _size2>& y) noexcept {
return !(x == y);
}
template<typename _Cont1, typename _It1, index_t _beg1, size_t _size1,
typename _Cont2, typename _It2, index_t _beg2, size_t _size2>
inline bool operator<= (const indev_it<_Cont1, _It1, _beg1, _size1>& x,
const indev_it<_Cont2, _It2, _beg2, _size2>& y) noexcept {
return !(y < x);
}
template<typename _Cont1, typename _It1, index_t _beg1, size_t _size1,
typename _Cont2, typename _It2, index_t _beg2, size_t _size2>
inline bool operator> (const indev_it<_Cont1, _It1, _beg1, _size1>& x,
const indev_it<_Cont2, _It2, _beg2, _size2>& y) noexcept {
return (y < x);
}
template<typename _Cont1, typename _It1, index_t _beg1, size_t _size1,
typename _Cont2, typename _It2, index_t _beg2, size_t _size2>
inline bool operator>= (const indev_it<_Cont1, _It1, _beg1, _size1>& x,
const indev_it<_Cont2, _It2, _beg2, _size2>& y) noexcept {
return !(x < y);
}
template<typename _Cont1, typename _It1, index_t _beg1, size_t _size1,
typename _Cont2, typename _It2, index_t _beg2, size_t _size2>
inline auto operator- (indev_it<_Cont1, _It1, _beg1, _size1>& x,
indev_it<_Cont1, _It1, _beg1, _size1>& y) noexcept
-> decltype (x.cursor() - y.cursor()) {
return (x.cursor() - y.cursor());
}
template<typename _Cont, typename _It, index_t _beg, size_t _size>
inline indev_it<_Cont, _It, _beg, _size>
operator+ (typename _Cont::difference_type n,
indev_it<_Cont, _It, _beg, _size>& it) noexcept {
return indev_it<_Cont, _It, _beg, _size>(it.owner(), it.cursor() + n);
}
#if defined _utl_have_concepts
template <typename T>
concept bool Indev_it = requires (T t, const T ct) {
// STL compatibility
typename T::value_type;
typename T::difference_type;
typename T::pointer;
typename T::reference;
requires same_ <
typename T::iterator_category,
std::input_iterator_tag
>::value;
{*t} -> typename T::value_type; // is dereferencable
{++t} -> T&; // is incrementable
{t++} -> T;
// Extras
{ct.owner()} ->auto&&;
{ct.cursor()} -> const size_t;
{ct.value()} -> auto&&;
};
#else
namespace indev_it_details {
using std::declval;
template <typename _Tp, typename =void>
struct is_indev_it_ : meta::false_ {};
template <typename _Tp>
struct is_indev_it_ <
_Tp,
meta::void_t <
typename _Tp::value_type,
typename _Tp::difference_type,
typename _Tp::pointer,
typename _Tp::reference,
// meta::use_if_same_t <
// typename _Tp::iterator_category,
// std::input_iterator_tag
// >
void
>
> : meta::true_ {};
}
// template <typename _Tp>
// constexpr bool Indev_it = indev_it_details::is_indev_it_<_Tp>::value;
#endif
/*
* ================= Indexed device Iterator =================
*/
template<typename cont_t, typename iter_t, index_t _beg =0, size_t _size = static_cast<size_t>(-1)-_beg>
class iodev_it {
using iterator_t = iodev_it <cont_t, iter_t, _beg, _size>;
public:
using type = iterator_t;
public:
using iterator_category = typename dev_iterator_traits <std::output_iterator_tag, iter_t>::iterator_category;
using value_type = typename dev_iterator_traits <std::output_iterator_tag, iter_t>::value_type;
using difference_type = typename dev_iterator_traits <std::output_iterator_tag, iter_t>::difference_type;
using pointer = typename dev_iterator_traits <std::output_iterator_tag, iter_t>::pointer;
using reference = typename dev_iterator_traits <std::output_iterator_tag, iter_t>::reference;
enum Cursor {
beg = _beg,
eod = _beg+_size,
};
private:
cont_t* owner_{nullptr};
index_t cursor_{eod};
struct value_type_t {
value_type v_;
value_type_t(value_type v =value_type{}) :
v_{v} { }
operator value_type() { return v_; }
operator reference() { return v_; }
value_type& operator= (const value_type& v) {
owner_->put (v_ =v, cursor_);
}
} value_ {};
public:
iodev_it () noexcept :
owner_ {nullptr},
cursor_{eod},
value_ {} { }
explicit iodev_it (cont_t* owner, size_t cursor =eod) noexcept :
owner_ {owner},
cursor_{cursor},
value_ {} { }
explicit iodev_it (const iterator_t& it) noexcept :
owner_ {const_cast<cont_t*>(it.owner_)},
cursor_{it.cursor_},
value_ {it.value_} { }
iterator_t& operator= (const iterator_t& it) noexcept {
owner_ = const_cast<cont_t*>(it.owner_);
cursor_ = it.cursor_;
value_ = it.value_;
}
public:
reference operator* () noexcept {
owner_->get (value_.v_, cursor_);
return value_;
}
pointer operator-> () noexcept {
owner_->get (value_.v_, cursor_);
return &value_;
}
iterator_t& operator++ () noexcept {
++cursor_;
return *this;
}
iterator_t operator++ (int) noexcept {
iterator_t ret = *this;
++cursor_;
return *this;
}
iterator_t& operator-- () noexcept {
--cursor_;
return *this;
}
iterator_t operator-- (int) noexcept {
iterator_t ret = *this;
--cursor_;
return *this;
}
reference operator[] (difference_type n) noexcept {
owner_->get (value_.v_, cursor_ = n);
return value_;
}
iterator_t& operator+= (difference_type n) noexcept {
cursor_ += n;
return *this;
}
iterator_t operator+ (difference_type n) const noexcept {
return iterator_t (owner_, cursor_ + n);
}
iterator_t& operator-= (difference_type n) noexcept {
cursor_ -= n;
return *this;
}
iterator_t operator- (difference_type n) const noexcept {
return iterator_t (owner_, cursor_ - n);
}
const cont_t* owner () const noexcept { return owner_; }
const index_t& cursor () const noexcept { return cursor_; }
//const value_type_t& value () const noexcept { return value_; }
};
template<typename _Cont1, typename _It1, index_t _beg1, size_t _size1,
typename _Cont2, typename _It2, index_t _beg2, size_t _size2>
inline bool operator== (const iodev_it<_Cont1, _It1, _beg1, _size1>& x,
const iodev_it<_Cont2, _It2, _beg2, _size2>& y) noexcept {
return (x.owner() == y.owner() &&
(x.cursor() == y.cursor()));
}
template<typename _Cont1, typename _It1, index_t _beg1, size_t _size1,
typename _Cont2, typename _It2, index_t _beg2, size_t _size2>
inline bool operator< (const iodev_it<_Cont1, _It1, _beg1, _size1>& x,
const iodev_it<_Cont2, _It2, _beg2, _size2>& y) noexcept {
return (x.cursor() < y.cursor());
}
// relative ops
template<typename _Cont1, typename _It1, index_t _beg1, size_t _size1,
typename _Cont2, typename _It2, index_t _beg2, size_t _size2>
inline bool operator!= (const iodev_it<_Cont1, _It1, _beg1, _size1>& x,
const iodev_it<_Cont2, _It2, _beg2, _size2>& y) noexcept {
return !(x == y);
}
template<typename _Cont1, typename _It1, index_t _beg1, size_t _size1,
typename _Cont2, typename _It2, index_t _beg2, size_t _size2>
inline bool operator<= (const iodev_it<_Cont1, _It1, _beg1, _size1>& x,
const iodev_it<_Cont2, _It2, _beg2, _size2>& y) noexcept {
return !(y < x);
}
template<typename _Cont1, typename _It1, index_t _beg1, size_t _size1,
typename _Cont2, typename _It2, index_t _beg2, size_t _size2>
inline bool operator> (const iodev_it<_Cont1, _It1, _beg1, _size1>& x,
const iodev_it<_Cont2, _It2, _beg2, _size2>& y) noexcept {
return (y < x);
}
template<typename _Cont1, typename _It1, index_t _beg1, size_t _size1,
typename _Cont2, typename _It2, index_t _beg2, size_t _size2>
inline bool operator>= (const iodev_it<_Cont1, _It1, _beg1, _size1>& x,
const iodev_it<_Cont2, _It2, _beg2, _size2>& y) noexcept {
return !(x < y);
}
template<typename _Cont1, typename _It1, index_t _beg1, size_t _size1,
typename _Cont2, typename _It2, index_t _beg2, size_t _size2>
inline auto operator- (iodev_it<_Cont1, _It1, _beg1, _size1>& x,
iodev_it<_Cont1, _It1, _beg1, _size1>& y) noexcept
-> decltype (x.cursor() - y.cursor()) {
return (x.cursor() - y.cursor());
}
template<typename _Cont, typename _It, index_t _beg, size_t _size>
inline iodev_it<_Cont, _It, _beg, _size>
operator+ (typename _Cont::difference_type n,
iodev_it<_Cont, _It, _beg, _size>& it) noexcept {
return iodev_it<_Cont, _It, _beg, _size>(it.owner(), it.cursor() + n);
}
#if defined _utl_have_concepts
template <typename T>
concept bool Idxdev_it = requires (T t, const T ct) {
// STL compatibility
typename T::value_type;
typename T::difference_type;
typename T::pointer;
typename T::reference;
requires same_<
typename T::iterator_category,
std::input_iterator_tag
>::value;
{*t} -> typename T::value_type; // is dereferencable
{++t} -> T&; // is incrementable
{t++} -> T;
// Extras
{ct.owner()} ->auto&&;
{ct.cursor()} -> const size_t;
{ct.value()} -> auto&&;
};
#else
namespace idxdev_it_details {
using std::declval;
template <typename _Tp, typename =void>
struct is_idxdev_it_ : meta::false_ {};
template <typename _Tp>
struct is_idxdev_it_ <
_Tp,
meta::void_t <
typename _Tp::value_type,
typename _Tp::difference_type,
typename _Tp::pointer,
typename _Tp::reference,
// meta::use_if_same_t <
// typename _Tp::iterator_category,
// std::input_iterator_tag
// >
void
>
> : meta::true_ {};
}
// template <typename _Tp>
// constexpr bool Idxdev_it = idxdev_it_details::is_idxdev_it_<_Tp>::value;
#endif
}
#endif /* __utl_dev_dev_iterators_h__ */
utl::istreamdev_it::operator++
iterator_t & operator++() noexcept
Definition: dev_iterators.h:193
utl::indev_it::value_
value_type value_
The current value, used as cache.
Definition: dev_iterators.h:489
utl::indev_it::iterator_t
indev_it< cont_t, iter_t, _beg, _size > iterator_t
< iterator type local name
Definition: dev_iterators.h:463
utl::iodev_it::value_type_t::v_
value_type v_
Current value buffer to access via get.
Definition: dev_iterators.h:774
utl::indev_it::operator[]
reference operator[](difference_type n)
[] operator. Is a combination of input method and dereference
Definition: dev_iterators.h:571
utl::operator==
bool operator==(const array< _Tp, _Nm > &lhs, const array< _Tp, _Nm > &rhs)
Definition: array.h:181
utl::istreamdev_it::owner_
cont_t * owner_
Definition: dev_iterators.h:149
utl::iodev_it::operator++
iterator_t & operator++() noexcept
Pre increment.
Definition: dev_iterators.h:830
utl::iodev_it::operator[]
reference operator[](difference_type n) noexcept
Random access through iterator.
Definition: dev_iterators.h:852
utl::outdev_it::pointer
typename dev_iterator_traits< std::output_iterator_tag, iter_t >::pointer pointer
Definition: dev_iterators.h:261
meta.h
Include all meta library.
utl::dev_iterator_traits< std::output_iterator_tag, data_t, void >::iterator_category
std::output_iterator_tag iterator_category
Definition: dev_iterators.h:44
utl::istreamdev_it::iterator_category
typename dev_iterator_traits< std::output_iterator_tag, data_t, void >::iterator_category iterator_category
Definition: dev_iterators.h:135
utl::istreamdev_it::_get
void _get(value_type &v)
Definition: dev_iterators.h:213
utl::indev_it::Cursor
Cursor
#define-like enumerator for Cursor
Definition: dev_iterators.h:477
utl::iodev_it::eod
Points one place after last item.
Definition: dev_iterators.h:758
utl::iodev_it::value_type_t
Definition: dev_iterators.h:773
utl::istreamdev_it::iterator_t
istreamdev_it< cont_t, data_t > iterator_t
Definition: dev_iterators.h:129
utl::output_iterator_tag
Iterator tags [std.iterator.tags] Extension: contiguous_iterator_tag for denoting contiguous iterator...
Definition: dev_iterators.h:55
utl::meta::void_t
void void_t
void_t type alias
Definition: detection.h:55
utl::outdev_it::outdev_it
outdev_it() noexcept
Default constructor results to end()
Definition: dev_iterators.h:283
utl::iodev_it::operator-=
iterator_t & operator-=(difference_type n) noexcept
Random cursor decrement.
Definition: dev_iterators.h:866
utl::iodev_it
Indexed device iterator type. We "future call" interface methods from owner class to provide iterator...
Definition: dev_iterators.h:740
utl::indev_it_details::is_indev_it_
Primary template to catch any non SPI interface types.
Definition: dev_iterators.h:695
utl::bidirectional_iterator_tag
Definition: dev_iterators.h:58
utl::ostreamdev_it::ostreamdev_it
ostreamdev_it(const iterator_t &it) noexcept
Basic copy constructor.
Definition: dev_iterators.h:99
utl::outdev_it::reference
typename dev_iterator_traits< std::output_iterator_tag, iter_t >::reference reference
Definition: dev_iterators.h:262
utl::outdev_it::Cursor
Cursor
#define-like enumerator for Cursor
Definition: dev_iterators.h:265
utl::ostreamdev_it::operator=
iterator_t & operator=(const iterator_t &it) noexcept
Basic copy assignment operator.
Definition: dev_iterators.h:102
utl::dev_iterator_traits< std::output_iterator_tag, data_t, void >::value_type
data_t value_type
Definition: dev_iterators.h:45
utl::meta::true_
bool_< true > true_
The type used as a compile-time boolean with true value.
Definition: integral.h:68
utl::ostreamdev_it::pointer
typename dev_iterator_traits< std::output_iterator_tag, data_t, void >::pointer pointer
Definition: dev_iterators.h:79
utl::istreamdev_it::value_
value_type value_
Definition: dev_iterators.h:154
utl::outdev_it::cursor_
index_t cursor_
virtual cursor for comparison operators
Definition: dev_iterators.h:276
utl::indev_it::operator+=
iterator_t & operator+=(difference_type n)
Definition: dev_iterators.h:576
utl::outdev_it::cursor
const index_t cursor() const noexcept
Export cursor for comparison.
Definition: dev_iterators.h:343
utl::idxdev_it_details::is_idxdev_it_
Primary template to catch any non SPI interface types.
Definition: dev_iterators.h:980
utl::ostreamdev_it::value_type
typename dev_iterator_traits< std::output_iterator_tag, data_t, void >::value_type value_type
Definition: dev_iterators.h:77
utl::indev_it::indev_it
indev_it(cont_t *own, size_t cur=eod) noexcept
Basic constructor.
Definition: dev_iterators.h:505
utl::operator+
indev_it< _Cont, _It, _beg, _size > operator+(typename _Cont::difference_type n, indev_it< _Cont, _It, _beg, _size > &it) noexcept
Definition: dev_iterators.h:659
utl::iodev_it::iodev_it
iodev_it(const iterator_t &it) noexcept
Basic copy constructor.
Definition: dev_iterators.h:800
utl::iodev_it::operator=
iterator_t & operator=(const iterator_t &it) noexcept
Basic copy assignment operator.
Definition: dev_iterators.h:805
utl::indev_it::operator--
iterator_t & operator--()
Pre decrement.
Definition: dev_iterators.h:560
utl::iodev_it::operator-
iterator_t operator-(difference_type n) const noexcept
Subtraction operation.
Definition: dev_iterators.h:871
utl::istreamdev_it::operator->
value_type * operator->() noexcept
Definition: dev_iterators.h:188
utl::istreamdev_it::value_type
typename dev_iterator_traits< std::output_iterator_tag, data_t, void >::value_type value_type
Definition: dev_iterators.h:136
utl::iodev_it::value_type_t::operator=
value_type & operator=(const value_type &v)
Definition: dev_iterators.h:779
utl::iodev_it::Cursor
Cursor
#define-like enumerator for Cursor
Definition: dev_iterators.h:756
utl::dev_iterator_traits< std::output_iterator_tag, data_t, void >::difference_type
void difference_type
Definition: dev_iterators.h:46
utl::iodev_it::operator*
reference operator*() noexcept
Definition: dev_iterators.h:819
utl::outdev_it::iterator_category
typename dev_iterator_traits< std::output_iterator_tag, iter_t >::iterator_category iterator_category
Definition: dev_iterators.h:258
utl::dev_iterator_traits
Device iterator collection.
Definition: dev_iterators.h:43
utl::iodev_it::value_type
typename dev_iterator_traits< std::output_iterator_tag, iter_t >::value_type value_type
Definition: dev_iterators.h:749
utl::ostreamdev_it::difference_type
typename dev_iterator_traits< std::output_iterator_tag, data_t, void >::difference_type difference_type
Definition: dev_iterators.h:78
utl::iodev_it::operator--
iterator_t & operator--() noexcept
Pre decrement.
Definition: dev_iterators.h:841
utl::contiguous_iterator_tag
Definition: dev_iterators.h:60
utl::outdev_it::value_type
typename dev_iterator_traits< std::output_iterator_tag, iter_t >::value_type value_type
Definition: dev_iterators.h:259
utl::indev_it::operator-
iterator_t operator-(difference_type n)
Definition: dev_iterators.h:587
utl::random_access_iterator_tag
Definition: dev_iterators.h:59
utl::outdev_it::outdev_it
outdev_it(cont_t *owner, index_t cursor=eod) noexcept
Basic constructor.
Definition: dev_iterators.h:287
utl::operator-
auto operator-(indev_it< _Cont1, _It1, _beg1, _size1 > &x, indev_it< _Cont1, _It1, _beg1, _size1 > &y) noexcept -> decltype(x.cursor() - y.cursor())
Definition: dev_iterators.h:651
utl::outdev_it
Output device iterator type. We "future call" interface methods from owner class to provide iterator ...
Definition: dev_iterators.h:250
utl::iodev_it::beg
Points the first item.
Definition: dev_iterators.h:757
utl::indev_it::iterator_category
typename dev_iterator_traits< std::output_iterator_tag, iter_t >::iterator_category iterator_category
Definition: dev_iterators.h:469
utl::outdev_it::operator*
iterator_t & operator*() noexcept
Definition: dev_iterators.h:314
utl::iodev_it::owner
const cont_t * owner() const noexcept
Export container for comparison.
Definition: dev_iterators.h:876
utl::indev_it::operator-=
iterator_t & operator-=(difference_type n)
Definition: dev_iterators.h:583
utl::indev_it::owner_
cont_t * owner_
Definition: dev_iterators.h:483
utl::input_iterator_tag
Definition: dev_iterators.h:56
utl::meta::false_
bool_< false > false_
The type used as a compile-time boolean with false value.
Definition: integral.h:69
utl::istreamdev_it::cursor_
Cursor cursor_
Definition: dev_iterators.h:155
utl::istreamdev_it::pointer
typename dev_iterator_traits< std::output_iterator_tag, data_t, void >::pointer pointer
Definition: dev_iterators.h:138
utl::operator>=
bool operator>=(const array< _Tp, _Nm > &lhs, const array< _Tp, _Nm > &rhs)
Definition: array.h:207
utl::iodev_it::value_
struct utl::iodev_it::value_type_t value_
utl::forward_iterator_tag
Definition: dev_iterators.h:57
utl::outdev_it::operator=
iterator_t & operator=(const iterator_t &it) noexcept
Basic copy assignment operator.
Definition: dev_iterators.h:295
utl::istreamdev_it::istreamdev_it
istreamdev_it(cont_t *owner=nullptr, Cursor cursor=eos) noexcept
Basic constructor.
Definition: dev_iterators.h:163
utl::ostreamdev_it::iterator_t
ostreamdev_it< cont_t, data_t > iterator_t
Definition: dev_iterators.h:70
utl::iodev_it::cursor_
index_t cursor_
virtual cursor for comparison operators
Definition: dev_iterators.h:767
utl::size_t
std::size_t size_t
Definition: types.h:37
utl::outdev_it::operator++
iterator_t & operator++() noexcept
Definition: dev_iterators.h:329
utl::outdev_it_details::is_outdev_it_
Primary template to catch any non SPI interface types.
Definition: dev_iterators.h:417
utl
STL&#39;s core language concepts.
Definition: _1wire.h:30
utl::iodev_it::iodev_it
iodev_it(cont_t *owner, size_t cursor=eod) noexcept
Basic constructor.
Definition: dev_iterators.h:795
utl::iodev_it::operator->
pointer operator->() noexcept
Arrow operator. This is where the input method is invoked.
Definition: dev_iterators.h:824
utl::dev_iterator_traits< std::output_iterator_tag, data_t, void >::pointer
data_t * pointer
Definition: dev_iterators.h:47
utl::ostreamdev_it::operator++
iterator_t & operator++() noexcept
Definition: dev_iterators.h:122
utl::istreamdev_it
Definition: dev_iterators.h:128
utl::outdev_it::beg
Points the first item (relative address)
Definition: dev_iterators.h:266
utl::indev_it
Input device iterator type. We "future call" interface methods from owner class to provide iterator f...
Definition: dev_iterators.h:461
utl::iodev_it::difference_type
typename dev_iterator_traits< std::output_iterator_tag, iter_t >::difference_type difference_type
Definition: dev_iterators.h:750
utl::iodev_it::iterator_t
iodev_it< cont_t, iter_t, _beg, _size > iterator_t
< iterator type local name
Definition: dev_iterators.h:742
utl::indev_it::operator*
reference operator*()
De-reference operator. No end() place dereference check is made.
Definition: dev_iterators.h:537
utl::iodev_it::value_type_t::value_type_t
value_type_t(value_type v=value_type{})
Definition: dev_iterators.h:775
utl::istreamdev_it::reference
typename dev_iterator_traits< std::output_iterator_tag, data_t, void >::reference reference
Definition: dev_iterators.h:139
utl::indev_it::cursor_
index_t cursor_
virtual cursor for comparison operators
Definition: dev_iterators.h:488
utl::operator>
bool operator>(const array< _Tp, _Nm > &lhs, const array< _Tp, _Nm > &rhs)
Definition: array.h:196
utl::iodev_it::operator+=
iterator_t & operator+=(difference_type n) noexcept
Random cursor increment.
Definition: dev_iterators.h:857
utl::indev_it::operator->
pointer operator->()
Arrow operator. No end() place dereference check is made.
Definition: dev_iterators.h:542
utl::indev_it::reference
typename dev_iterator_traits< std::output_iterator_tag, iter_t >::reference reference
Definition: dev_iterators.h:473
utl::istreamdev_it::owner
const cont_t * owner() const noexcept
Export container for comparison.
Definition: dev_iterators.h:204
utl::ostreamdev_it::ostreamdev_it
ostreamdev_it(cont_t *owner=nullptr) noexcept
Basic constructor.
Definition: dev_iterators.h:96
utl::ostreamdev_it::reference
typename dev_iterator_traits< std::output_iterator_tag, data_t, void >::reference reference
Definition: dev_iterators.h:80
utl::indev_it::operator=
iterator_t & operator=(const iterator_t &it) noexcept
Basic copy assignment operator.
Definition: dev_iterators.h:515
utl::iodev_it::iodev_it
iodev_it() noexcept
Default constructor.
Definition: dev_iterators.h:790
utl::ostreamdev_it
Definition: dev_iterators.h:69
utl::indev_it::operator+
iterator_t operator+(difference_type n)
Definition: dev_iterators.h:580
utl::istreamdev_it::valid
Definition: dev_iterators.h:144
utl::index_t
size_t index_t
index_t and size_t mend to be interchangeable
Definition: types.h:38
utl::indev_it::eod
Points one place after last item.
Definition: dev_iterators.h:479
utl::outdev_it::difference_type
typename dev_iterator_traits< std::output_iterator_tag, iter_t >::difference_type difference_type
Definition: dev_iterators.h:260
utl::iodev_it::cursor
const index_t & cursor() const noexcept
Export cursor for comparison.
Definition: dev_iterators.h:878
utl::indev_it::indev_it
indev_it(const iterator_t &it) noexcept
Basic copy constructor.
Definition: dev_iterators.h:510
utl::operator!=
bool operator!=(const array< _Tp, _Nm > &lhs, const array< _Tp, _Nm > &rhs)
Definition: array.h:186
utl::indev_it::difference_type
typename dev_iterator_traits< std::output_iterator_tag, iter_t >::difference_type difference_type
Definition: dev_iterators.h:471
utl::ostreamdev_it::operator*
iterator_t & operator*() noexcept
Definition: dev_iterators.h:110
utl::istreamdev_it::operator*
value_type & operator*() noexcept
Definition: dev_iterators.h:183
utl::istreamdev_it::operator=
iterator_t & operator=(const iterator_t &it) noexcept
Basic copy assignment operator.
Definition: dev_iterators.h:173
utl::istreamdev_it::eos
Definition: dev_iterators.h:145
utl::istreamdev_it::cursor
const Cursor cursor() const noexcept
Export cursor for comparison.
Definition: dev_iterators.h:208
utl::outdev_it::iterator_t
outdev_it< cont_t, iter_t, _beg, _end > iterator_t
iterator type local name
Definition: dev_iterators.h:252
utl::istreamdev_it::value
const value_type & value() const noexcept
Export value for comparison.
Definition: dev_iterators.h:206
utl::iodev_it::owner_
cont_t * owner_
Definition: dev_iterators.h:762
utl::indev_it::cursor
const index_t cursor() const noexcept
Export cursor for comparison.
Definition: dev_iterators.h:593
utl::indev_it::pointer
typename dev_iterator_traits< std::output_iterator_tag, iter_t >::pointer pointer
Definition: dev_iterators.h:472
utl::istreamdev_it::init
Definition: dev_iterators.h:143
utl::outdev_it::owner
const cont_t * owner() const noexcept
Export container for comparison.
Definition: dev_iterators.h:341
utl::outdev_it::owner_
cont_t * owner_
Definition: dev_iterators.h:270
utl::ostreamdev_it::iterator_category
typename dev_iterator_traits< std::output_iterator_tag, data_t, void >::iterator_category iterator_category
Definition: dev_iterators.h:76
utl::istreamdev_it::Cursor
Cursor
#define-like enumerator for Cursor-like behavior
Definition: dev_iterators.h:142
utl::indev_it::indev_it
indev_it() noexcept
Default constructor.
Definition: dev_iterators.h:500
utl::dev_iterator_traits< std::output_iterator_tag, data_t, void >::reference
data_t & reference
Definition: dev_iterators.h:48
utl::iodev_it::operator+
iterator_t operator+(difference_type n) const noexcept
Addition operation.
Definition: dev_iterators.h:862
utl::outdev_it::eod
Points one place after last item (relative address)
Definition: dev_iterators.h:267
utl::istreamdev_it::difference_type
typename dev_iterator_traits< std::output_iterator_tag, data_t, void >::difference_type difference_type
Definition: dev_iterators.h:137
utl::iodev_it::iterator_category
typename dev_iterator_traits< std::output_iterator_tag, iter_t >::iterator_category iterator_category
Definition: dev_iterators.h:748
utl::indev_it::operator++
iterator_t & operator++()
Pre increment.
Definition: dev_iterators.h:548
utl::iodev_it::pointer
typename dev_iterator_traits< std::output_iterator_tag, iter_t >::pointer pointer
Definition: dev_iterators.h:751
utl::ostreamdev_it::owner_
cont_t * owner_
Definition: dev_iterators.h:84
impl.h
Implementation detail main forward header.
utl::outdev_it::outdev_it
outdev_it(const iterator_t &it) noexcept
Basic copy constructor.
Definition: dev_iterators.h:291
utl::indev_it::owner
const cont_t * owner() const noexcept
Export container for comparison.
Definition: dev_iterators.h:591
utl::indev_it::beg
Points the first item.
Definition: dev_iterators.h:478
utl::iodev_it::reference
typename dev_iterator_traits< std::output_iterator_tag, iter_t >::reference reference
Definition: dev_iterators.h:752
utl::indev_it::value_type
typename dev_iterator_traits< std::output_iterator_tag, iter_t >::value_type value_type
Definition: dev_iterators.h:470
utl::istreamdev_it::istreamdev_it
istreamdev_it(const iterator_t &it) noexcept
Basic copy constructor.
Definition: dev_iterators.h:168