Welcome to mirror list, hosted at ThFree Co, Russian Federation.

stl_iterator.hpp « base - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 8e6915982ef57fa16707bcbd003665fa79764108 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#pragma once

#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wshorten-64-to-32"
#endif

#include <boost/iterator/iterator_facade.hpp>

#if defined(__clang__)
#pragma clang diagnostic pop
#endif

namespace detail
{
struct Dummy
{
  template <class T> Dummy & operator=(T const &) { return *this; }
};
}

class CounterIterator :
    public boost::iterator_facade<CounterIterator, detail::Dummy, boost::forward_traversal_tag>
{
  size_t m_count;
public:
  CounterIterator() : m_count(0) {}
  size_t GetCount() const { return m_count; }

  detail::Dummy & dereference() const
  {
    static detail::Dummy dummy;
    return dummy;
  }
  void increment() { ++m_count; }
};