dune-istl 2.8.0
Loading...
Searching...
No Matches
counter.hh
Go to the documentation of this file.
1#ifndef DUNE_ISTL_COMMON_COUNTER_HH
2#define DUNE_ISTL_COMMON_COUNTER_HH
3
4#include <cassert>
5#include <typeinfo>
6#include <iostream>
7#include <memory>
8#include <tuple>
9#include <utility>
10
11#include <dune/common/typeutilities.hh>
12
13constexpr std::size_t maxcount = 100;
14
15#define DUNE_GET_COUNTER(Tag) \
16 (counterFunc(Dune::PriorityTag<maxcount>{}, Tag{}, Dune::CounterImpl::ADLTag{}))
17
18#define DUNE_INC_COUNTER(Tag) \
19 namespace { \
20 namespace CounterImpl { \
21 constexpr std::size_t \
22 counterFunc(Dune::PriorityTag<DUNE_GET_COUNTER(Tag)+1> p, Tag, ADLTag) \
23 { \
24 return p.value; \
25 } \
26 } \
27 } \
28 static_assert(true, "unfudge indentation")
29
30namespace Dune {
31 namespace {
32
33 namespace CounterImpl {
34
35 struct ADLTag {};
36
37 template<class Tag>
38 constexpr std::size_t counterFunc(Dune::PriorityTag<0>, Tag, ADLTag)
39 {
40 return 0;
41 }
42
43 } // end namespace CounterImpl
44 } // end empty namespace
45} // end namespace Dune
46#endif // DUNE_ISTL_COMMON_COUNTER_HH
constexpr std::size_t maxcount
Definition: counter.hh:13
Definition: allocator.hh:9