forward_list
build forward list stl from sratch
Loading...
Searching...
No Matches
forward_lists< T, Allocator >::Iterator Class Reference

Public Types

using iterator_category = std::forward_iterator_tag
 iterator category iterator category adalah label yang menjelaskan kemampuan sebuah
using value_type = T
using difference_type = std::ptrdiff_t
using pointer = T*
using reference = T&

Public Member Functions

 Iterator (Node *n)
T & operator* ()
reference operator* () const
pointer operator-> () const
Iteratoroperator++ ()
Iteratoroperator-> ()
Iterator operator++ (int)
bool operator!= (const Iterator &others) const
bool operator== (const Iterator &others) const
Nodeget_raw () const

Private Attributes

Nodenode

Friends

std::ostream & operator<< (std::ostream &os, const Iterator &it)

Member Typedef Documentation

◆ difference_type

template<typename T, typename Allocator = std::allocator<T>>
using forward_lists< T, Allocator >::Iterator::difference_type = std::ptrdiff_t

◆ iterator_category

template<typename T, typename Allocator = std::allocator<T>>
using forward_lists< T, Allocator >::Iterator::iterator_category = std::forward_iterator_tag

iterator category iterator category adalah label yang menjelaskan kemampuan sebuah

Iterator traits

  • iterator_category
    traits ini adalah menandakan kemampuan sebuah iterator pada forward_list kita memakai forward_iterator dikarenakan singly linked list hanya punya pointer next yang memunkinkan node hanya bisa bergerak maju
  • value_type traits ini adalah type data yg digunakan oleh forward_list karena sudah ada Template,maka kita dapat langsung memakai Templates tersebut
  • difference_type tipe integer untuk menyatakan selisih dua iterator,ini dipakai pada std::distance untuk menghitung banyak node diantara 2 iterator
  • using pointer = T*; tipe pointer ke elemen yang ditunjuk iterator
  • using reference = T&; tipe referensi ke elemen,Memungkinkan penggunaan *it untuk mengakses elemen.

◆ pointer

template<typename T, typename Allocator = std::allocator<T>>
using forward_lists< T, Allocator >::Iterator::pointer = T*

◆ reference

template<typename T, typename Allocator = std::allocator<T>>
using forward_lists< T, Allocator >::Iterator::reference = T&

◆ value_type

template<typename T, typename Allocator = std::allocator<T>>
using forward_lists< T, Allocator >::Iterator::value_type = T

Constructor & Destructor Documentation

◆ Iterator()

template<typename T, typename Allocator = std::allocator<T>>
forward_lists< T, Allocator >::Iterator::Iterator ( Node * n)
inline

Member Function Documentation

◆ get_raw()

template<typename T, typename Allocator = std::allocator<T>>
Node * forward_lists< T, Allocator >::Iterator::get_raw ( ) const
inline

◆ operator!=()

template<typename T, typename Allocator = std::allocator<T>>
bool forward_lists< T, Allocator >::Iterator::operator!= ( const Iterator & others) const
inline

◆ operator*() [1/2]

template<typename T, typename Allocator = std::allocator<T>>
T & forward_lists< T, Allocator >::Iterator::operator* ( )
inline

◆ operator*() [2/2]

template<typename T, typename Allocator = std::allocator<T>>
reference forward_lists< T, Allocator >::Iterator::operator* ( ) const
inline

◆ operator++() [1/2]

template<typename T, typename Allocator = std::allocator<T>>
Iterator & forward_lists< T, Allocator >::Iterator::operator++ ( )
inline

◆ operator++() [2/2]

template<typename T, typename Allocator = std::allocator<T>>
Iterator forward_lists< T, Allocator >::Iterator::operator++ ( int )
inline

◆ operator->() [1/2]

template<typename T, typename Allocator = std::allocator<T>>
Iterator & forward_lists< T, Allocator >::Iterator::operator-> ( )
inline

◆ operator->() [2/2]

template<typename T, typename Allocator = std::allocator<T>>
pointer forward_lists< T, Allocator >::Iterator::operator-> ( ) const
inline

◆ operator==()

template<typename T, typename Allocator = std::allocator<T>>
bool forward_lists< T, Allocator >::Iterator::operator== ( const Iterator & others) const
inline

◆ operator<<

template<typename T, typename Allocator = std::allocator<T>>
std::ostream & operator<< ( std::ostream & os,
const Iterator & it )
friend

Member Data Documentation

◆ node

template<typename T, typename Allocator = std::allocator<T>>
Node* forward_lists< T, Allocator >::Iterator::node
private

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