hamigaki.png

前のページ 上に戻る ホーム 次のページ

Class template first_iterator

hamigaki::first_iterator —

pairの反復子を基にfirstのみを反復する

Synopsis

template<typename Iterator> 
class first_iterator {
public:
  // types
  typedef /* see below */                                            value_type;       
  typedef /* see below */                                            reference;        
  typedef /* see below */                                            pointer;          
  typedef implementation defined                                     difference_type;  
  typedef typename std::iterator_traits<Iterator>::iterator_category iterator_category;

  // construct/copy/destruct
  first_iterator();
  first_iterator(const Iterator&);

  // operators
  reference operator*() const;
  first_iterator<Iterator>& operator++();

  // queries
  const Iterator& base() const;

  private: Iterator current;
};

// creation
first_iterator<Iterator> make_first_iterator(Iterator);

Description

value_typereferencepointerは、typename std::iterator_traits<Iterator>::referenceに応じて次のように決定される。

iterator_traits<Iterator>::reference value_type reference pointer
const T& T::first_type const T::first_type& const T::first_type*
T& T::first_type T::first_type& T::first_type*
const T T::first_type T::first_type T::first_type*
T T::first_type T::first_type T::first_type*

first_iterator construct/copy/destruct

  1. first_iterator();
    Effects: current = Iterator()
  2. first_iterator(const Iterator& x);
    Effects: current = x

first_iterator operators

  1. reference operator*() const;
    Returns: current->first
  2. first_iterator<Iterator>& operator++();
    Effects: ++current
    Returns: *this

first_iterator queries

  1. const Iterator& base() const;
    Returns: current

first_iterator creation

  1. first_iterator<Iterator> make_first_iterator(Iterator x);
    Returns: first_iterator<Iterator>(x)
製作著作 © 2006-2008 Takeshi Mouri

前のページ 上に戻る ホーム 次のページ