STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Types | Public Member Functions | Private Attributes | List of all members
checked_array_iterator< _Iterator > Class Template Reference

Public Types

using iterator_category = typename iterator_traits< _Iterator >::iterator_category
 
using value_type = typename iterator_traits< _Iterator >::value_type
 
using difference_type = typename iterator_traits< _Iterator >::difference_type
 
using pointer = typename iterator_traits< _Iterator >::pointer
 
using reference = typename iterator_traits< _Iterator >::reference
 
typedef _Iterator _Unchecked_type
 

Public Member Functions

 checked_array_iterator ()
 
 checked_array_iterator (const _Iterator _Array, const size_t _Size, const size_t _Index=0)
 
_Iterator base () const
 
checked_array_iterator_Rechecked (const _Unchecked_type _Right)
 
_Unchecked_type _Unchecked () const
 
reference operator* () const
 
pointer operator-> () const
 
checked_array_iteratoroperator++ ()
 
checked_array_iterator operator++ (int)
 
checked_array_iteratoroperator-- ()
 
checked_array_iterator operator-- (int)
 
checked_array_iteratoroperator+= (const difference_type _Off)
 
checked_array_iterator operator+ (const difference_type _Off) const
 
checked_array_iteratoroperator-= (const difference_type _Off)
 
checked_array_iterator operator- (const difference_type _Off) const
 
difference_type operator- (const checked_array_iterator &_Right) const
 
reference operator[] (const difference_type _Off) const
 
bool operator== (const checked_array_iterator &_Right) const
 
bool operator!= (const checked_array_iterator &_Right) const
 
bool operator< (const checked_array_iterator &_Right) const
 
bool operator> (const checked_array_iterator &_Right) const
 
bool operator<= (const checked_array_iterator &_Right) const
 
bool operator>= (const checked_array_iterator &_Right) const
 

Private Attributes

_Iterator _Myarray
 
size_t _Mysize
 
size_t _Myindex
 

Member Typedef Documentation

template<class _Iterator>
typedef _Iterator checked_array_iterator< _Iterator >::_Unchecked_type
template<class _Iterator>
using checked_array_iterator< _Iterator >::difference_type = typename iterator_traits<_Iterator>::difference_type
template<class _Iterator>
using checked_array_iterator< _Iterator >::iterator_category = typename iterator_traits<_Iterator>::iterator_category
template<class _Iterator>
using checked_array_iterator< _Iterator >::pointer = typename iterator_traits<_Iterator>::pointer
template<class _Iterator>
using checked_array_iterator< _Iterator >::reference = typename iterator_traits<_Iterator>::reference
template<class _Iterator>
using checked_array_iterator< _Iterator >::value_type = typename iterator_traits<_Iterator>::value_type

Constructor & Destructor Documentation

template<class _Iterator>
checked_array_iterator< _Iterator >::checked_array_iterator ( )
inline
311  : _Myarray(), _Mysize(0), _Myindex(0)
312  { // default construct
313  }
_Iterator _Myarray
Definition: iterator:490
size_t _Mysize
Definition: iterator:491
size_t _Myindex
Definition: iterator:492
template<class _Iterator>
checked_array_iterator< _Iterator >::checked_array_iterator ( const _Iterator  _Array,
const size_t  _Size,
const size_t  _Index = 0 
)
inline
316  : _Myarray(_Array), _Mysize(_Size), _Myindex(_Index)
317  { // construct with array, size, and optional index
318  _IDL_VERIFY_ALWAYS(_Index <= _Size, "checked_array_iterator construction index out of range");
319  }
#define _IDL_VERIFY_ALWAYS(assertion, message)
Definition: xutility:51
_Iterator _Myarray
Definition: iterator:490
_CRT_BEGIN_C_HEADER _Check_return_ _Ret_maybenull_ _In_ size_t _Size
Definition: corecrt_malloc.h:58
_In_ size_t _In_ int _Index
Definition: time.h:102
size_t _Mysize
Definition: iterator:491
size_t _Myindex
Definition: iterator:492

Member Function Documentation

template<class _Iterator>
checked_array_iterator& checked_array_iterator< _Iterator >::_Rechecked ( const _Unchecked_type  _Right)
inline
329  { // reset from unchecked iterator
331  return (*this);
332  }
_Iterator _Myarray
Definition: iterator:490
constexpr const _Ty &() _Right
Definition: algorithm:3723
size_t _Myindex
Definition: iterator:492
template<class _Iterator>
_Unchecked_type checked_array_iterator< _Iterator >::_Unchecked ( ) const
inline
335  { // make an unchecked iterator
336  return (base());
337  }
_Iterator base() const
Definition: iterator:321
template<class _Iterator>
_Iterator checked_array_iterator< _Iterator >::base ( ) const
inline
322  { // return unwrapped iterator
323  return (_Myarray + _Myindex);
324  }
_Iterator _Myarray
Definition: iterator:490
size_t _Myindex
Definition: iterator:492
template<class _Iterator>
bool checked_array_iterator< _Iterator >::operator!= ( const checked_array_iterator< _Iterator > &  _Right) const
inline
463  { // test for iterator inequality
464  return (!(*this == _Right));
465  }
template<class _Iterator>
reference checked_array_iterator< _Iterator >::operator* ( ) const
inline
340  { // return designated object
341  _IDL_VERIFY_ALWAYS(_Myarray, "cannot dereference value-initialized or null checked_array_iterator");
342  _IDL_VERIFY_ALWAYS(_Myindex < _Mysize, "cannot dereference end checked_array_iterator");
343  return (_Myarray[_Myindex]);
344  }
#define _IDL_VERIFY_ALWAYS(assertion, message)
Definition: xutility:51
_Iterator _Myarray
Definition: iterator:490
size_t _Mysize
Definition: iterator:491
size_t _Myindex
Definition: iterator:492
template<class _Iterator>
checked_array_iterator checked_array_iterator< _Iterator >::operator+ ( const difference_type  _Off) const
inline
408  { // return this + integer
409  checked_array_iterator _Tmp = *this;
410  return (_Tmp += _Off);
411  }
Definition: iterator:301
template<class _Iterator>
checked_array_iterator& checked_array_iterator< _Iterator >::operator++ ( )
inline
354  { // preincrement
355  _IDL_VERIFY_ALWAYS(_Myarray, "cannot increment value-initialized or null checked_array_iterator");
356  _IDL_VERIFY_ALWAYS(_Myindex < _Mysize, "cannot increment checked_array_iterator past end");
357  ++_Myindex;
358  return (*this);
359  }
#define _IDL_VERIFY_ALWAYS(assertion, message)
Definition: xutility:51
_Iterator _Myarray
Definition: iterator:490
size_t _Mysize
Definition: iterator:491
size_t _Myindex
Definition: iterator:492
template<class _Iterator>
checked_array_iterator checked_array_iterator< _Iterator >::operator++ ( int  )
inline
362  { // postincrement
363  checked_array_iterator _Tmp = *this;
364  ++*this;
365  return (_Tmp);
366  }
Definition: iterator:301
template<class _Iterator>
checked_array_iterator& checked_array_iterator< _Iterator >::operator+= ( const difference_type  _Off)
inline
384  { // increment by integer
385  if (_Off != 0)
386  {
387  _IDL_VERIFY_ALWAYS(_Myarray, "cannot seek value-initialized or null checked_array_iterator");
388  }
389 
390  if (_Off < 0)
391  {
392 #pragma warning(suppress: 4146) // unary minus operator applied to unsigned type, result still unsigned
393  _IDL_VERIFY_ALWAYS(_Myindex >= -static_cast<size_t>(_Off),
394  "cannot seek checked_array_iterator before begin");
395  }
396 
397  if (_Off > 0)
398  {
399  _IDL_VERIFY_ALWAYS(_Mysize - _Myindex >= static_cast<size_t>(_Off),
400  "cannot seek checked_array_iterator after end")
401  }
402 
403  _Myindex += _Off;
404  return (*this);
405  }
#define _IDL_VERIFY_ALWAYS(assertion, message)
Definition: xutility:51
_Iterator _Myarray
Definition: iterator:490
size_t _Mysize
Definition: iterator:491
size_t _Myindex
Definition: iterator:492
template<class _Iterator>
checked_array_iterator checked_array_iterator< _Iterator >::operator- ( const difference_type  _Off) const
inline
438  { // return this - integer
439  checked_array_iterator _Tmp = *this;
440  return (_Tmp -= _Off);
441  }
Definition: iterator:301
template<class _Iterator>
difference_type checked_array_iterator< _Iterator >::operator- ( const checked_array_iterator< _Iterator > &  _Right) const
inline
444  { // return difference of iterators
445  _IDL_VERIFY_ALWAYS(_Myarray == _Right._Myarray && _Mysize == _Right._Mysize,
446  "cannot subtract incompatible checked_array_iterators");
447  return (_Myindex - _Right._Myindex);
448  }
#define _IDL_VERIFY_ALWAYS(assertion, message)
Definition: xutility:51
_Iterator _Myarray
Definition: iterator:490
size_t _Mysize
Definition: iterator:491
size_t _Myindex
Definition: iterator:492
template<class _Iterator>
checked_array_iterator& checked_array_iterator< _Iterator >::operator-- ( )
inline
369  { // predecrement
370  _IDL_VERIFY_ALWAYS(_Myarray, "cannot decrement value-initialized or null checked_array_iterator");
371  _IDL_VERIFY_ALWAYS(_Myindex != 0, "cannot decrement checked_array_iterator before begin");
372  --_Myindex;
373  return (*this);
374  }
#define _IDL_VERIFY_ALWAYS(assertion, message)
Definition: xutility:51
_Iterator _Myarray
Definition: iterator:490
size_t _Myindex
Definition: iterator:492
template<class _Iterator>
checked_array_iterator checked_array_iterator< _Iterator >::operator-- ( int  )
inline
377  { // postdecrement
378  checked_array_iterator _Tmp = *this;
379  --*this;
380  return (_Tmp);
381  }
Definition: iterator:301
template<class _Iterator>
checked_array_iterator& checked_array_iterator< _Iterator >::operator-= ( const difference_type  _Off)
inline
414  { // decrement by integer
415  if (_Off != 0)
416  {
417  _IDL_VERIFY_ALWAYS(_Myarray, "cannot seek value-initialized or null checked_array_iterator");
418  }
419 
420  if (_Off > 0)
421  {
422  _IDL_VERIFY_ALWAYS(_Myindex >= static_cast<size_t>(_Off),
423  "cannot seek checked_array_iterator before begin");
424  }
425 
426  if (_Off < 0)
427  {
428 #pragma warning(suppress: 4146) // unary minus operator applied to unsigned type, result still unsigned
429  _IDL_VERIFY_ALWAYS(_Mysize - _Myindex >= -static_cast<size_t>(_Off),
430  "cannot seek checked_array_iterator after end");
431  }
432 
433  _Myindex -= _Off;
434  return (*this);
435  }
#define _IDL_VERIFY_ALWAYS(assertion, message)
Definition: xutility:51
_Iterator _Myarray
Definition: iterator:490
size_t _Mysize
Definition: iterator:491
size_t _Myindex
Definition: iterator:492
template<class _Iterator>
pointer checked_array_iterator< _Iterator >::operator-> ( ) const
inline
347  { // return pointer to class object
348  _IDL_VERIFY_ALWAYS(_Myarray, "cannot dereference value-initialized or null checked_array_iterator");
349  _IDL_VERIFY_ALWAYS(_Myindex < _Mysize, "cannot dereference end checked_array_iterator");
350  return (_Myarray + _Myindex);
351  }
#define _IDL_VERIFY_ALWAYS(assertion, message)
Definition: xutility:51
_Iterator _Myarray
Definition: iterator:490
size_t _Mysize
Definition: iterator:491
size_t _Myindex
Definition: iterator:492
template<class _Iterator>
bool checked_array_iterator< _Iterator >::operator< ( const checked_array_iterator< _Iterator > &  _Right) const
inline
468  { // test if this < _Right
469  _IDL_VERIFY_ALWAYS(_Myarray == _Right._Myarray && _Mysize == _Right._Mysize,
470  "cannot compare incompatible checked_array_iterators");
471  return (_Myindex < _Right._Myindex);
472  }
#define _IDL_VERIFY_ALWAYS(assertion, message)
Definition: xutility:51
_Iterator _Myarray
Definition: iterator:490
size_t _Mysize
Definition: iterator:491
size_t _Myindex
Definition: iterator:492
template<class _Iterator>
bool checked_array_iterator< _Iterator >::operator<= ( const checked_array_iterator< _Iterator > &  _Right) const
inline
480  { // test if this <= _Right
481  return (!(_Right < *this));
482  }
template<class _Iterator>
bool checked_array_iterator< _Iterator >::operator== ( const checked_array_iterator< _Iterator > &  _Right) const
inline
456  { // test for iterator equality
457  _IDL_VERIFY_ALWAYS(_Myarray == _Right._Myarray && _Mysize == _Right._Mysize,
458  "cannot compare incompatible checked_array_iterators for equality");
459  return (_Myindex == _Right._Myindex);
460  }
#define _IDL_VERIFY_ALWAYS(assertion, message)
Definition: xutility:51
_Iterator _Myarray
Definition: iterator:490
size_t _Mysize
Definition: iterator:491
size_t _Myindex
Definition: iterator:492
template<class _Iterator>
bool checked_array_iterator< _Iterator >::operator> ( const checked_array_iterator< _Iterator > &  _Right) const
inline
475  { // test if this > _Right
476  return (_Right < *this);
477  }
template<class _Iterator>
bool checked_array_iterator< _Iterator >::operator>= ( const checked_array_iterator< _Iterator > &  _Right) const
inline
485  { // test if this >= _Right
486  return (!(*this < _Right));
487  }
template<class _Iterator>
reference checked_array_iterator< _Iterator >::operator[] ( const difference_type  _Off) const
inline
451  { // subscript
452  return (*(*this + _Off));
453  }

Member Data Documentation

template<class _Iterator>
_Iterator checked_array_iterator< _Iterator >::_Myarray
private
template<class _Iterator>
size_t checked_array_iterator< _Iterator >::_Myindex
private
template<class _Iterator>
size_t checked_array_iterator< _Iterator >::_Mysize
private

The documentation for this class was generated from the following file: