~ubuntu-branches/ubuntu/oneiric/libclaw/oneiric

« back to all changes in this revision

Viewing changes to claw/it_index.hpp

  • Committer: Bazaar Package Importer
  • Author(s): Julien Jorge
  • Date: 2010-12-23 20:55:14 UTC
  • mfrom: (4.2.1 sid)
  • Revision ID: james.westby@ubuntu.com-20101223205514-s10m6ywla7s4ttqf
Tags: 1.6.1-3
Upload in sid

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
  CLAW is a free library without any particular aim but being useful to 
5
5
  anyone.
6
6
 
7
 
  Copyright (C) 2005-2008 Julien Jorge
 
7
  Copyright (C) 2005-2010 Julien Jorge
8
8
 
9
9
  This library is free software; you can redistribute it and/or
10
10
  modify it under the terms of the GNU Lesser General Public
41
41
   */
42
42
  template<class T> class it_index
43
43
  {
 
44
  public:
 
45
    typedef typename std::iterator_traits<T>::value_type value_type;
 
46
    typedef typename std::iterator_traits<T>::difference_type difference_type;
 
47
    typedef typename std::iterator_traits<T>::pointer pointer;
 
48
    typedef typename std::iterator_traits<T>::reference reference;
 
49
 
44
50
  private:
45
51
    /** \brief Iterator. */
46
52
    T   m_it;
 
53
 
47
54
    /** \brief Iterator's position. */
48
55
    int m_index;
49
56
 
121
128
    it_index<T> operator/( int index ) const
122
129
    { return it_index<T>(m_it - (m_index - m_index/index), m_index / index); }
123
130
  
124
 
    typename T::value_type operator*() { return *m_it; }
 
131
    reference operator*() const { return *m_it; }
 
132
    pointer operator->() const { return &*m_it; }
125
133
 
126
134
    // Pr�incr�ment
127
135
    it_index<T>& operator++()