Dune Core Modules (2.8.0)

counter.hh
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
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
Dune namespace.
Definition: alignedallocator.hh:11
Helper class for tagging priorities.
Definition: typeutilities.hh:85
Utilities for type computations, constraining overloads, ...
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Dec 22, 23:30, 2024)